Submitted by beginnernx on Mon, 07/07/2014 - 23:06
Forums:
Hi,
I have very basic question, if i am creating one line by using Apis, i search for createline method in objectbrowser,
what it returns to me nxopen.curvecollection.createline(nxopen.point3d,nxopen.3d),but when i go for writing the code i use workpart.curves.createline().
why ?
thanks
re: object browser
The object browser is showing you that the .CreateLine method belongs to the curvecollection object which you can find in the NXOpen namespace. The CurveCollection is an object in its own right with its own properties and methods available for you to use. However, a CurveCollection can't exist in isolation; each curve collection belongs to a part object. Each part object has a curve collection property that it refers to as simply 'curves'. When you create a line object, you need to specify which part to create the line in. The 'workpart' variable is an object that you have previously specified to refer to the current work part.
In short, the object browser is showing you the definition of the curvecollection object, to use its properties and methods, you must refer to an actual instance of the object. This instance is owned by a part object; the instance of a part object that you are using is your workpart.
Thanks for the reply, so part
Thanks for the reply, so part object in this case is workpart(thesession.parts.work),i have one more example like in object browser when i search for (getfeatures) it gives Nxopen.features.featurecollection.getfeatures,& how i use in my application workpart.features.getfeatures(), so here feature is a isolation(in nxopen.features.featurecollection.getfeatures),so each feature will belong to workpart, but what about featurecollection ?
My next question, so anything what i search in object browser will actually be referenced through part object ?