Message 1 of 1
[Bug?] Inconsistency between Sketch.transform documentation and actual behavior
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Based on Sketch.transform documentation:
it "Gets and sets the transform of the sketch with respect to model space." and "Setting the transform will fail in the case where the sketch is parametric"
But setting it actually multiplies the existing matrix in the new matrix.
Here is a code block showing this inconsistency:
import adsk.core, adsk.fusion, traceback
def run(context):
try:
ui = adsk.core.UserInterface.cast(None)
app :adsk.fusion.Application = adsk.core.Application.get()
ui = app.userInterface
des :adsk.fusion.Design = app.activeProduct
root :adsk.fusion.Component = des.rootComponent
baseFeature = root.features.baseFeatures.add()
baseFeature.startEdit()
sketch = root.sketches.add(root.xYConstructionPlane)
matrix1 = adsk.core.Matrix3D.create()
matrix1.translation = adsk.core.Vector3D.create(2, 0, 0)
sketch.transform = matrix1
matrix2 = adsk.core.Matrix3D.create()
matrix2.translation = adsk.core.Vector3D.create(0, 3, 0)
sketch.transform = matrix2
sketch.sketchCurves.sketchCircles.addByCenterRadius(adsk.core.Point3D.create(0, 0, 0), 1)
baseFeature.finishEdit()
ui.messageBox(str(sketch.transform.asArray()))
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
and the result:
Website: https://perceptino.com