04-05-2023
05:11 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
04-05-2023
05:11 AM
Hi @ltujxm1. Unfortunately, I was not able to use the part you uploaded, because it was probably created in a newer version of Inventor than mine (I'm using 2022.4.1 at the moment). But I did create an iLogic rule you can try out. This rule simply gets the first 3D sketch that it finds in the part, then gathers all 3D sketch points that may exist in that sketch to an object collection. Then it tries to create a SketchSpline3D from those points. There are 3 possible fit methods available to choose from, but I am specifying the 'smooth' one in this example. The other two fit methods are an 'ACAD' version, and a 'Sweet' version.
Dim oPDoc As PartDocument = ThisDoc.Document
Dim oPDef As PartComponentDefinition = oPDoc.ComponentDefinition
If oPDef.Sketches3D.Count = 0 Then Exit Sub
Dim oSketch3D As Sketch3D = oPDef.Sketches3D.Item(1)
Dim oSP3Ds As SketchPoints3D = oSketch3D.SketchPoints3D
If oSP3Ds.Count = 0 Then Exit Sub
Dim oSPColl As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection
For Each oSP3D As SketchPoint3D In oSP3Ds
oSPColl.Add(oSP3D)
Next
Dim oSSp3D As SketchSpline3D = Nothing
Try
oSSp3D = oSketch3D.SketchSplines3D.Add(oSPColl, SplineFitMethodEnum.kSmoothSplineFit)
Catch
Logger.Error("Error creating SketchSpline3D.")
End Try
Wesley Crihfield
(Not an Autodesk Employee)