Message 1 of 2
Redefining/Adding LoftRails to existing lofts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello:
I have a part file containing numerous lofts. I (am trying) to write a rule that will look at each loft in the part file and if it ends in a "-1" add a rail (3d sketch named "3D Sketch Road"). The 3D sketch "3D Sketch Road" contains a single continuous projected edge (lines/curves).
This is the code as it is now:
Dim doc As PartDocument = ThisDoc.Document Dim oFeatures As PartFeatures = doc.ComponentDefinition.Features Dim fName As String Dim rOne As String Dim targetSketchName As String = "3D Sketch Road" Dim railSketch As Sketch3D = Nothing For Each sketch As Sketch3D In doc.ComponentDefinition.Sketches3D If Sketch.Name = targetSketchName Then railSketch = Sketch End If Next For Each Feature As Object In oFeatures fName = Feature.Name rOne = Right(fName, 2) If rOne = "-1" Then If Feature.Type = ObjectTypeEnum.kLoftFeatureObject Then Dim oloftFeature As LoftFeature = Feature MsgBox(fName) MsgBox(railSketch.Name) Dim oRail As Profile3D oRail = railSketch.Profiles3D.AddOpen oloftFeature.Definition.LoftRails.Add(oRail) End If End If Next
It ran initially but now I am getting an unspecified error on the "oloftFeature.Definition.LoftRails.Add(oRail)" line.
The two message boxes display the appropriate selections for the selected feature and sketch.
I would appreciate any ideas that might help me get it straightened out.
Thanks;
Nick