how to edit profile



I whish to connect to a feature on a part and edit it's profile (delete all current 2d lines and draw new ones).

Is there any example on how to do so?





Re: how to edit profile

There is no problem (technically) to edit an existing profile. There is more a logical problem of how any subsequent features will update (or not) depending on their creation based on the old profile lines.

So when replacing a profile entirely you will probably encounter problems in the feature tree of your model.

The following code example replaces all drawing entities (relations, lines, arcs, circles, ...) of the profile from the first extruded protrusion in the first design model by a single circle:

' PAR: Edit the profile of an extruded protrusion.
Dim objDoc As SolidEdgePart.PartDocument = objApp.ActiveDocument
Dim objModel As SolidEdgePart.Model = objDoc.Models.Item(1)
Dim objExtProt As SolidEdgePart.ExtrudedProtrusion = objModel.ExtrudedProtrusions.Item(1)
Dim objProf As Profile = objExtProt.Profile
' Delete all drawing objects from the profile
Dim objObjs As DrawingObjects = objProf.DrawingObjects
For Each obj In objObjs
  obj.GetType().InvokeMember("Delete", Reflection.BindingFlags.InvokeMethod, Nothing, obj, Nothing)
' Add a single circle on the profile
objProf.Circles2d.AddByCenterRadius(0, 0, 0.03)
Dim stat As Integer = objProf.End(ProfileValidationType.igProfileClosed)
Debug.Assert(stat = 0)
' Recompute the model starting at the protrusion