I am trying to add bodies to the tool-nocut-component in the machine tool builder.
I started recording a journal to get a rough overview what is needed.
Everything works fine so far, i just have a problem in understanding the behaviour of:
I have two bodies which I want to identify by name, because they are both named "NOCUT".
When I record the journal this code is the result:
Dim body1 As Body = CType(workPart.Bodies.FindObject("UNPARAMETERIZED_FEATURE(3)"), Body) kinematicComponentBuilder1.AddGeometry(body1) Dim body2 As Body = CType(workPart.Bodies.FindObject("UNPARAMETERIZED_FEATURE(1)"), Body) kinematicComponentBuilder1.AddGeometry(body2)
This will result in showing two bodies when selecting the non_cutting part in the machine tool builder
I changed to code to cycle through all bodies with the name "NOCUT":
For Each bbody As Body In theSession.Parts.Work.Bodies Dim aBodyTag As Tag = Tag.Null theUfSession.Obj.CycleByNameAndType(displayPart.Tag, "NOCUT", UFConstants.UF_solid_type, True, aBodyTag) If Not aBodyTag = Tag.Null Then BodyNoCut = CType(theSession.GetObjectManager().GetTaggedObject(aBodyTag), Body) NoCutKinCompBuild.AddGeometry(BodyNoCut) Else Exit Sub End If Next
This will result in showing one body when selecting the non_cutting part in the machine tool builder,
but it will show the correct two bodies when i am retrieving the tool from the database in CAM.
Shouldn't be the result the same? And if not, how can I change to code to display the selected parts correctly in the machine tool builder?
Thanks for your help!
Solved! Go to Solution.
1) I would report to GTAC - it may be a bug if both bodies have the same name
2) I would try a test - try naming the bodies "NOCUT1", "NOCUT2", etc.
Then loop thru, but build the name to search for on-the-fly, and add them. - see if this works better.
if (2) works correctly, you have a solution (maybe not one you want, but it is a solution)
Production: NX10.0.3.5 MP5 + patch/TC11.2
I'd rather be e-steemed than e-diseaseled
I just made this test, I renamed all the bodies to NOCUT0, NOCUT1 etc. in the same loop, just before adding them. Now both bodies will be shown if I select the NON_CUTTING part at the machine tool builder.
Good Idea! Haven't thought about rename.