cancel
Showing results for 
Search instead for 
Did you mean: 

Generate Toolpath method in NXOpen API

Creator
Creator

Hello,

 

When I recorded a c# journal file by right-click a toolpath -> Generate, a dialog was popup as attached image, then I tried different option by clicking "Generate remaining" and "Overwrite all" buttons, but the journal shows these two options use the same methods with no difference.

 So how to generate toolpath with these two options "Generate remaining" and "Overwrite all" in NXOpen API?

 

20160912_0512.png

 

    NXOpen.Session theSession = NXOpen.Session.GetSession();
    NXOpen.Part workPart = theSession.Parts.Work;
    NXOpen.Part displayPart = theSession.Parts.Display;
    NXOpen.Session.UndoMarkId markId1;
    markId1 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Generate Tool Paths");
    
    NXOpen.CAM.CAMObject[] objects1 = new NXOpen.CAM.CAMObject[1];
    NXOpen.CAM.PlanarMilling planarMilling1 = (NXOpen.CAM.PlanarMilling)workPart.CAMSetup.CAMOperationCollection.FindObject("PROFILE_3D_COPY_COPY_COPY_~1");
    objects1[0] = planarMilling1;
    theSession.CAMSession.PathDisplay.HideToolPath(planarMilling1);
    
    workPart.CAMSetup.GenerateToolPath(objects1);
    
    NXOpen.CAM.PlanarMilling planarMilling2 = (NXOpen.CAM.PlanarMilling)workPart.CAMSetup.CAMOperationCollection.FindObject("PROFILE_3D_COPY_COPY_COPY");
    theSession.CAMSession.PathDisplay.ShowToolPath(planarMilling2);
    
    NXOpen.Session.UndoMarkId markId2;
    markId2 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Generate Tool Paths");
    
    NXOpen.CAM.CAMObject[] objects2 = new NXOpen.CAM.CAMObject[1];
    objects2[0] = planarMilling2;
    theSession.CAMSession.PathDisplay.HideToolPath(planarMilling2);
    
    workPart.CAMSetup.GenerateToolPath(objects2);

 

9 REPLIES

Re: Generate Toolpath method in NXOpen API

Esteemed Contributor
Esteemed Contributor

The difference is the objects selected to be generated.

The list for "generate remaining" should be smaller that the one for "generate all".

Both options are just a filter and there is no direct API method to do this.

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.0, FBM, MRL 3.1.4 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 10.1
Development: VB.NET, Tcl/Tk    Testing: NX11.0 EAP, NX12.0 EAP

How to Get the Most from Your Signature in the Community

Re: Generate Toolpath method in NXOpen API

Creator
Creator

Hi Stefan,

 

Thanks for your rapid reply.

 

If I modify toolpath (e.g. add a new point or change feedrate) in the original toolpath, I want these modifications to overwrite to toolpaths in other transformed instance operations. Is there any way to do that through NXOpen API?

 

Thanks

reilley

Re: Generate Toolpath method in NXOpen API

Esteemed Contributor
Esteemed Contributor

Any instance of an operation will be regenerated based on the manufacturing preferences.

There is also the GenerateToolPathWithOptions method, if I remember correctly.

Have you tried generating the source operation and checked if the instanced operations are automatically updated?

I think there is a method to check if the operation has instances and another method to get the instanced operations, but I have never had the need to use these, since our preferences are set to always update instanced operations if the source changes.

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.0, FBM, MRL 3.1.4 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 10.1
Development: VB.NET, Tcl/Tk    Testing: NX11.0 EAP, NX12.0 EAP

How to Get the Most from Your Signature in the Community

Re: Generate Toolpath method in NXOpen API

Creator
Creator

Hi Stefan,

 

Unfortunately, I was unable to get instanced operations updated. The steps are as follows.

1. Take an operation in NX v10.0.3.5. MRB-> Object ->Transform->Instance (Type Translate - delta ).

2. then go back and edit the original operation toolpath, and it flags Edited.

3. but the transformed instance is not updated at all;

4. select the original operation, MRB -> Generate -> "Generate remaining", then check the toolpath in the transformed instance, note that the toolpaht is updated.

The preference is set as attached image.

The prt file is also attached.

 

By the way, I could not find GenerateToolPathWithOptions method.

Yes, there is a new method GetOtherInstances() in v10.0.3 to get instances, but they are not updated.

You mentioned that "since our preferences are set to always update instanced operations if the source changes". May I know how you set it?

 

Re: Generate Toolpath method in NXOpen API

Esteemed Contributor
Esteemed Contributor

Our preferences for operations are as shown below.

OperationPreferences.PNG

 

 

I get the following notice when I edit the source operation, which is as expected:

OperationLinkInformation.PNGIf I generate the source operation from the context menu, there is no such dialog as you showed.

I suspect this is due to the setting to force regeneration, I would not select it.

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.0, FBM, MRL 3.1.4 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 10.1
Development: VB.NET, Tcl/Tk    Testing: NX11.0 EAP, NX12.0 EAP

How to Get the Most from Your Signature in the Community

Re: Generate Toolpath method in NXOpen API

Esteemed Contributor
Esteemed Contributor

Just to confirm...

On the Object -> transform dialog, you select the"Result" option "Instance"?

Ken Akerboom Sr CAx Systems Engr, Moog, Inc.
Production: NX10.0.3.5 MP5 + patch/TC11.2
I'd rather be e-steemed than e-diseaseled


Re: Generate Toolpath method in NXOpen API

Creator
Creator

Hi Ken,

 

This is what i set

20160915_0911.png

Re: Generate Toolpath method in NXOpen API

Creator
Creator

Hi Stefan,

I tried to follow your steps with the same manufacturing preference setting after modifying toolpath in the source operation CAVITY_MILL. However, the changes in the toolpath is gone. Is any step or setting wrong?

20160915_1521.png

 

 What I used to generate toolpath is to right-click the source operation with modified toolpath -> Generate, then the dialog shows.

20160915_1525.png

 

 

 

 

Re: Generate Toolpath method in NXOpen API

Esteemed Contributor
Esteemed Contributor

In the second image the path is edited, which is shown by the wrench in the path column.

In the model you sent us this is not the case, which is the cause for us not getting the dialog.

Anyways, the API will not ask for anything, it will just generate the tool path as it was told.

It is up to you to check if a tool path is edited or not before you send it into the generate API method.

Generally you must always do any checks on your own, since these are not part of the API methods.

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.0, FBM, MRL 3.1.4 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 10.1
Development: VB.NET, Tcl/Tk    Testing: NX11.0 EAP, NX12.0 EAP

How to Get the Most from Your Signature in the Community