[NXOpen VB] How to remove parameters of a feature/object

Hello!
I'm new to NXOpen Journals but I have almost reached a good progress on my journal.
Let's assume you want to run a journal inside a part.
The main and only goal of my journal is to generate/create a surface which is the result of an extrusion or in certain cases of a Surface generated with a swept feature. That's all.
My script is organized with a section where you toggle the possibility to create a Datum CSYS, choose its layer, then insert many parameters which will create geometric entities (like points, spline, directions, arcs, helix, all needed to generate the surface), choose if you want to show them, choose again a layer where you will find only the support geometry, then choose the work layer where you will find the final Surface (which is the main function of the journal).

So, this is the workflow:

1. Datum (Yes/No) and its layer ---> Done;
2. Geometry and its layer ---> Almost done;
3. Surface (Extrusion on Z direction or made with a swept) ---> Almost done.
4. Starting with a new part (empty), on the Part Navigator I want to see only the Datum CSYS and the Body which represents the Surface. Other entities are without parameters, so they are not listed on the Part Navigator panel.

My question is this one: is there a way to remove parameters of helix, extrusion, swept function?
I would like to have a journal which does not need to "scan" or search for determined object on a layer or certain function listen on a "For Each" loop.
Still today I'm not finding the solution... :(

For example (hiding parameters lines), the following code generates a Swept feature on the Part Navigator. If I manually remove the feature parameters, I obtain a Body on the Part Navigator. I'm trying to get this automatic with the journal.


Dim sweptBuilder As NXOpen.Features.SweptBuilder
Dim nullNXOpen_Features_swept As NXOpen.Features.Swept = Nothing
sweptBuilder = workPart.Features.CreateSweptBuilder(nullNXOpen_Features_swept)
Dim swept_surf As NXOpen.Features.Swept
swept_surf = sweptBuilder.CommitFeature()
sweptBuilder.Destroy()

I hope someone could help me.
Best regards,

kalo86

The Features.RemoveParametersBuilder will remove the parameters from the given feature. Recording a journal while removing the parametes of a feature will show you how to use the builder.

Since your code is creating the features, simply keep a reference to them to use later. There is no need to search for the features later. For example, in your code snippet above, a swept feature is created and your reference is named "swept_surf"; if/when you want to remove the parameters from "swept_surf", just pass "swept_surf" into the .RemoveParametersBuilder object.

Hi, thank you for the answer.
Anyway the feature RemoveParameters does not work if I pass "swept_surf".
I found the solution in this way:

Dim removeParametersBuilder1 As NXOpen.Features.RemoveParametersBuilder
removeParametersBuilder1 = workPart.Features.CreateRemoveParametersBuilder()
removeParametersBuilder1.Objects.Add(swept_surf.GetEntities)
Dim swpt_no_parameters As NXOpen.Spline
swept_no_parameters = removeParametersBuilder1.Commit()
removeParametersBuilder3.Destroy()

Now I have to find a way/method to delete the "swept_no_parameters" spline. Do you have an advice?

Regards,
kalo86

Reading through the thread again, it sounds like your journal creates various features to finally create an extruded or swept surface. The code then removes the parameters from the extrusion/swept and now you want to delete the various features/geometry that created it. Is this correct?

If so, you can get references to the swept parent features (before you remove its parameters, or perhaps your code has these references already). You should then be able to delete these parent features and the geometry that they created will be deleted along with the feature.

Thanks again for the replay :)
The question is a little bit different, I think.
Please read this sequence:

Create a section (not associative spline);
Create a helix path (with helixbuilder.Commit);
Create a swept surface (with sweptbuilder.Commit).

Doing this I get two features on the Part Navigator: helix and swept.
My goal is to leave a "Body" without any parameter on the Part Navigator.
For this I used the removeparameters feature to obtain a Body from the swept feature (just done), I used again another removeparameters feature to "delete" the helix feature on the Part Navigator (just done) obtaining a not associative spline. Perfect! On the Part Navigator I finally see only a Body.

Since the Body (sheetbody) is not linked to any feature, now I am free to delete the path (ex helix, now a spline).

How can I delete the spline (which was the previous helix without parameters, now a spline)?
This is my "problem" :(

Regards,
kalo86

To remove the parameters of the helix feature, you must have a reference to the helix feature. Instead of removing the helix feature parameters, simply delete the helix feature. The curves created by the feature should be deleted with the feature (unless, perhaps, there is another child feature of the helix?).

Yes, you are right, I could delete the helix feature but I don't know how to do it.

The following code is regarding the helix feature:


Dim helix As NXOpen.Features.Helix
helixBuilder1 = workPart.Features.CreateHelixBuilder(nullNXOpen_Features_helix)
helixBuilder1.OrientationOption = NXOpen.Features.HelixBuilder.OrientationOptions.Specified
helixBuilder1.SizeLaw.Value.RightHandSide = 5
helixBuilder1.PitchLaw.Value.RightHandSide = 1
helixBuilder1.StartLimit.Expression.RightHandSide = 0
helixBuilder1.EndLimit.Expression.RightHandSide = 10
helixBuilder1.CoordinateSystem = cartesianCoordinateSystem
helix = helixBuilder1.CommitFeature()
helixBuilder1.Destroy()

I tried a lot of ways but still today I'm unable to delete this feature.

Create a helix feature in your part. Start the journal recorder, delete the helix feature, stop recording, and examine the code. Take what you need and integrate it into your code.

Done, finally! Thanks for your help!