Message 1 of 3
Sketch profiles added in random order
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
The oct 2019 update includes a fix for missing profiles:
##################
Now I think there is a new error: The sketch profiles is added in seemingly random order.
##################
To illustrate the problem, I draw two spheres by revolving profiles.
import adsk.core, adsk.fusion, math app = adsk.core.Application.get() doc = app.documents.add(adsk.core.DocumentTypes.FusionDesignDocumentType) root = app.activeProduct.rootComponent sketch = root.sketches.add(root.xYConstructionPlane) arcs = sketch.sketchCurves.sketchArcs lines = sketch.sketchCurves.sketchLines revolves = root.features.revolveFeatures #First sphere arc = arcs.addByCenterStartSweep(adsk.core.Point3D.create(10, 4, 2), adsk.core.Point3D.create(9, 4, 2), math.pi) axisLine = lines.addByTwoPoints(adsk.core.Point3D.create(9, 4, 2), adsk.core.Point3D.create(11, 4, 2)) print(sketch.profiles.count) profile = sketch.profiles.item(0) revInput = revolves.createInput(profile, axisLine, adsk.fusion.FeatureOperations.NewBodyFeatureOperation) revInput.setAngleExtent(False, adsk.core.ValueInput.createByReal(2*math.pi)) revolves.add(revInput) #Second sphere arc = arcs.addByCenterStartSweep(adsk.core.Point3D.create(0, 2, 1), adsk.core.Point3D.create(-2, 2, 1), math.pi) axisLine = lines.addByTwoPoints(adsk.core.Point3D.create(-2, 2, 1), adsk.core.Point3D.create(2, 2, 1)) print(sketch.profiles.count) profile = sketch.profiles.item(0) #This is wrong!! revInput = revolves.createInput(profile, axisLine, adsk.fusion.FeatureOperations.NewBodyFeatureOperation) revInput.setAngleExtent(False, adsk.core.ValueInput.createByReal(2*math.pi)) revolves.add(revInput)
Notice, that the second sphere also uses
sketch.profiles.item(0)
This is should be
sketch.profiles.item(1)
as there has just been added a profile.
I have tried with 100 randomly generated profiles(spheres), and I can not see any pattern in when the profile is added to the beginning or end of sketch.profiles !
##################
Output(correct) of the above(wrong) code:
If the code is corrected, the output is wrong: