Cancel
Showing results for 
Search instead for 
Did you mean: 

Need Coding Suggestions...

Valued Contributor
Valued Contributor

Hi, I am trying to find a way to take string names of the parts in an assembly and measure them with measure bodies for volume.

 

I might use a journal and I'll get the string names by querying the assembly for DB_PART_DATA or just by using .name.

 

How could I pass a group of string names into NX, and then measure the parts?

 

An array maybe?

2 REPLIES

Re: Need Coding Suggestions...

Genius
Genius

junfan wrote:

Hi, I am trying to find a way to take string names of the parts in an assembly and measure them with measure bodies for volume.

 

I might use a journal and I'll get the string names by querying the assembly for DB_PART_DATA or just by using .name.

 

How could I pass a group of string names into NX, and then measure the parts?

 

An array maybe?


You could use the Block UI Style to generate a dialog box (.dlx file) and python code.

 

#define the MeasureVolume function

def MeasureVolume(self, partname_argument):
#you would need to record the commands or look through the online #documentation 
#to find what the specific methods are
.......
......................
#
def main():
    thepart_selector = None
    try:
        thepart_selector =  part_selector()
        #  The following method shows the dialog box immediately
        thepart_selector.Show()
        #call your measure volume function or any other function for that matter
        thepart_selector.MeasureVolume(partnamearg)

Re: Need Coding Suggestions...

Legend
Legend

In the 'Solution Center' search for 'report mass and weight of all bodies in assembly'.  It has the VB code.  You can tweak it to acheive what you need.

 

Hope this helps.