05-25-2020
02:36 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
05-25-2020
02:36 AM
The HelicalCurve contains some sketch entities and one of these is of type SketchFixedSpline3D. This is the object we want to get the length of. Thats actually pretty simple since the object has a length property. It could be a good idea to loop through the sketch entities to find that object. If you add this rule and set it to trigger on any model parameter change I think you'll get the result you want ![]()
Dim oDoc As PartDocument = ThisDoc.Document Dim Sketch As Sketch3D 'Dim SE As SketchEntity3D Dim SE As HelicalCurve Sketch = oDoc.ComponentDefinition.Sketches3D(2) 'SE = ThisDoc.Document.ComponentDefinition.Sketches3D(2).SketchLines3D(1) SE = Sketch.HelicalCurves(1) 'Get parameter Dim oParam As Inventor.Parameter Try oParam = Parameter.Param("HelicalCurveLength") Catch 'Parameter doesnt exist End Try Dim oUM As UnitsOfMeasure = oDoc.UnitsOfMeasure For Each oEnt As SketchEntity3D In SE.SketchEntities If oEnt.Type = ObjectTypeEnum.kSketchFixedSpline3DObject Dim oSpline As SketchFixedSpline3D = oEnt MsgBox(oUM.GetStringFromValue(oSpline.Length, oUM.LengthUnits)) If oParam Is Nothing oParam = oDoc.ComponentDefinition.Parameters.UserParameters.AddByExpression("HelicalCurveLength", _ oUM.GetStringFromValue(oSpline.Length, oUM.LengthUnits), oUM.LengthUnits) Else Parameter("HelicalCurveLength") = oUM.GetStringFromValue(oSpline.Length, oUM.LengthUnits) End If End If Next iLogicVb.UpdateWhenDone = True
Jhoel Forshav
Download my free Inventor Addin - Hole Projector
LinkedIn | Ideas | Contributions | Blog posts | Website