cancel
Showing results for 
Search instead for 
Did you mean: 

NxOpen.Point3d in python

Genius
Genius

I'm trying to create a cube generating function by adapting the colored block example in the /SampleNXOpenApplications python folder

 

What exactly is the NXOpen.Point3d object? Is it a list(array) of floats?

 

self.theLw.WriteLine(str(originpt)) returns what looks like a list

originpt is the argument for the NXopen.Point3d object

 

https://docs.plm.automation.siemens.com/data_services/resources/nx/10/nx_api/en_US/custom/nxopen_pyt...

 

This method works fine

def buildcube(self, originpt, l, w, h):
.....

blockFeatureBuilder1.SetOriginAndLengths(originpt, str(l), str(h), str(w))

but this approach gets an error message "NXOpen.Point 3d object not callable"

 

def buildcube(self, originpt, l, w, h):
.......
        blockFeatureBuilder1.SetHeight(str(h))
        blockFeatureBuilder1.SetWidth(str(w))
        blockFeatureBuilder1.SetLength(str(l))
        blockFeatureBuilder1.Origin(originpt)

 

also, when trying to iterate the originpt I get an error message stating that NXopen.point3d object is not subscriptable which would suggest it is not a list, tuple or dict

 

for n in range(3):
          blockFeatureBuilder1.SetOriginAndLengths(originpt, str(l), str(h), str(w))
          
          originpt[0] +=l
          originpt[1] +=w
          originpt[2] +=h

How else can I modify/increment an NXopen.point3d object?

 

4 REPLIES

Re: Nx.Open.Point3d in python/Menger sponge

Siemens Phenom Siemens Phenom
Siemens Phenom
The documentation you cited is the right stuff to read. It says that a Point3d is a struct with three members called X, Y, Z, which are of type float. So, no, it is not indexable. To modify a Point3d object, you write something like
myPoint.X = 3
myPoint.Y = 7.5
myPoint.Z = -2
山田
yamada

Re: Nx.Open.Point3d in python/Menger sponge

Genius
Genius

Yamada wrote:
The documentation you cited is the right stuff to read. It says that a Point3d is a struct with three members called X, Y, Z, which are of type float. So, no, it is not indexable. To modify a Point3d object, you write something like
myPoint.X = 3
myPoint.Y = 7.5
myPoint.Z = -2

Thanks for the reply. That clarifies things.

 

How come the methods below do not work? I get an error message stating that "NXopen.point3d object is not callable."

 

        blockFeatureBuilder1.SetHeight(str(h))
        blockFeatureBuilder1.SetWidth(str(w))
        blockFeatureBuilder1.SetLength(str(l))
        blockFeatureBuilder1.Origin(originpt)

While this method works perfectly fine

blockFeatureBuilder1.SetOriginAndLengths(originpt, str(l), str(h), str(w))

 

 

 

 

Re: Nx.Open.Point3d in python/Menger sponge

Genius
Genius

Try this and see if it works

 

blockFeatureBuilder1.Origin = originpt

 

Re: Nx.Open.Point3d in python/Menger sponge

Genius
Genius

That works, thanks!

 

This was what I was going off of in the documentation. https://docs.plm.automation.siemens.com/data_services/resources/nx/10/nx_api/en_US/custom/nxopen_pyt...

 

 

Setter Method

Signature Origin(origin)
Parameters:	origin(NXOpen.Point3d)