# Quick Mpoint Question

**URL:** https://forum.highend3d.com/t/quick-mpoint-question/48937
**Category:** Maya
**Tags:** python
**Created:** [November 8, 2007, 9:45am UTC](https://forum.highend3d.com/t/quick-mpoint-question/48937 "2007-11-08T09:45:45Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![isam](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/i/3d9bf3/32.png) [@isam](https://forum.highend3d.com/u/isam)
#### Post date: [November 8, 2007, 9:45am UTC](https://forum.highend3d.com/t/quick-mpoint-question/48937/1 "2007-11-08T09:45:45Z")

</div>

i started workin with python yesterday, and i am absolutely amazed by the EXTREME flexibility that it has, yes i have fallen in love!!

focus isam focus! back to the point, i am trying to set a an MPoint to specific numbers i got from a file, but the initializing is workin if i set the number manually, like   
point = OpenMaya.MPoint(0,0,0,1)

but if i try to set it up tthru a variable,

point = OpenMaya.MPoint(coordinates)  
(coordinates is an array of size 4)

i get this error,

# Error: in method 'new\_MPoint', argument 1 of type 'float const [4]'  
# Traceback (most recent call last):  
# File "", line 1, in   
# File "C:\engserv\rbuild\208\build\wrk\optim\runTime\Python\Lib\site-packages\maya\OpenMaya.py", line 5278, in \_\_init\_\_  
# TypeError: in method 'new\_MPoint', argument 1 of type 'float const [4]' #

i know its sth really easy, but i wish i cld get some help here

thnx folks

---

<div class="post-metadata">

### Author: ![rjpieke](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/r/45deac/32.png) [@rjpieke](https://forum.highend3d.com/u/rjpieke)
#### Post date: [November 8, 2007, 11:12am UTC](https://forum.highend3d.com/t/quick-mpoint-question/48937/2 "2007-11-08T11:12:39Z")

</div>

QUOTE(isam @ 11/08/07, 09:45 AM) [snapback]276186[/snapback]  
point = OpenMaya.MPoint(coordinates)  
(coordinates is an array of size 4)

i get this error,  
# Error: in method 'new\_MPoint', argument 1 of type 'float const [4]'  
# Traceback (most recent call last):  
# File "", line 1, in   
# File "C:\engserv\rbuild\208\build\wrk\optim\runTime\Python\Lib\site-packages\maya\OpenMaya.py", line 5278, in \_\_init\_\_  
# TypeError: in method 'new\_MPoint', argument 1 of type 'float const [4]' #

Yeah, you can't exactly do this ... the constructor is expecting individual floats. Fortunately, you can "explode" the array. I personally don't see this in a lot of Python code (possibly for a good reason - I'm not sure), but here you go:

c = [1.1, 2.2, 3.3, 4.4]  
p2 = maya.OpenMaya.MPoint( \*c )

Cheers!

---

<div class="post-metadata">

### Author: ![isam](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/i/3d9bf3/32.png) [@isam](https://forum.highend3d.com/u/isam)
#### Post date: [November 8, 2007, 1:02pm UTC](https://forum.highend3d.com/t/quick-mpoint-question/48937/3 "2007-11-08T13:02:27Z")

</div>

thanks 4 the response, but this doens t work either, the problem seems to be coming fro mthe variable, as if i set the c to

c = [coordinates[0], coordinates[1], coordinates[2], coordinates[3]]

i seem to be getting the same error as before

# Error: in method 'new\_MPoint', argument 1 of type 'double'  
# Traceback (most recent call last):  
# File "", line 1, in   
# File "C:\engserv\rbuild\208\build\wrk\optim\runTime\Python\Lib\site-packages\maya\OpenMaya.py", line 5278, in \_\_init\_\_  
# TypeError: in method 'new\_MPoint', argument 1 of type 'double' #

---

<div class="post-metadata">

### Author: ![joojaa](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/j/5daacb/32.png) [@joojaa](https://forum.highend3d.com/u/joojaa)
#### Post date: [November 8, 2007, 1:45pm UTC](https://forum.highend3d.com/t/quick-mpoint-question/48937/4 "2007-11-08T13:45:00Z")

</div>

your apparently trying to pass in worng types (such as int or string whan you need double)? This happens sometimes between non/strongly typed interfaces.

If you just domp your data it dont get cast as far as i know but im not sure. i never use the \* because it contains a slight caveat.

---

<div class="post-metadata">

### Author: ![isam](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/i/3d9bf3/32.png) [@isam](https://forum.highend3d.com/u/isam)
#### Post date: [November 10, 2007, 11:48am UTC](https://forum.highend3d.com/t/quick-mpoint-question/48937/5 "2007-11-10T11:48:47Z")

</div>

yup that was it, was passin it as a string instead of a float! thnx m8
