Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to change scale factors via Sketch.transform setting ?

Message 1 of 5
136 Views, 4 Replies

How to change scale factors via Sketch.transform setting ?

Dear all,
I am leaning Fusion script for weeks, however can not successfully change scale factors via Sketch.transform setting using the following codes under direct mode:
        sketch = sketches.add(rootComp.xYConstructionPlane)
        new_transform = adsk.core.Matrix3D.create()
        new_transform.setCell(0, 0, 2)
        new_transform.setCell(1, 1, 2)
        new_transform.setCell(2, 2, 2)
        # ar166 = (2.0, 0.0, 0.0, 0.0, 0.0, 2.0, 0.0, 0.0, 0.0, 0.0, 2.0, 0.0, 0.0, 0.0, 0.0, 1.0)
        # new_transform.setWithArray(ar166)
        sketch.transform = new_transform
        I have error message here :
        # RuntimeError: 2 : InternalValidationError : xlMat->isValidNonScaledTransformMatrix()


I am not sure if any examples available for this purpose ?

Thanks a lot !

Tags (1)
Message 2 of 5
in reply to: serviceXS69Y

Hi @serviceXS69Y -San.


Only the unit matrix can be set with the transform property.

If you want to double all the elements in a sketch, you must double each sketch entity.

Message 3 of 5
in reply to: kandennti

Dear Sir / Madam kandennti,
Thank you very much for your answer, so that will not include the consideration of scaling using the Sketch.transform property. Also since I need change or correlate differently for different geometries for each sketch, and need to re-create  and adjust features or constraints parameters according to these changed geometries of sketches,  so it seems has little real demand for editing the Sketch.transform directly at least for my current recognitions.

Thank again and best regards !

Message 4 of 5
in reply to: serviceXS69Y

The API is missing the equivalent of the Scale command in a sketch. That's what you need. Hopefully, this will be addressed in the future.

Brian Ekins
Inventor and Fusion 360 API Expert
Message 5 of 5
in reply to: serviceXS69Y

Dear Sir BrianEkins,

Yes while it is not must, yet is more convenient at some context if the Sketch.transform could be changed via scripts.

Beside, I also learnt all your API YouTube video that is very helpful.

Thank you very much !

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th

Autodesk Design & Make Report