How to change scale factors via Sketch.transform setting ?

serviceXS69Y
Participant

How to change scale factors via Sketch.transform setting ?

serviceXS69Y
Participant
Participant
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 !

0 Likes
Reply
411 Views
4 Replies
Replies (4)

kandennti
Mentor
Mentor

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.

1 Like

serviceXS69Y
Participant
Participant

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 !

0 Likes

BrianEkins
Mentor
Mentor

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
Website/Blog: https://EkinsSolutions.com
2 Likes

serviceXS69Y
Participant
Participant

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 !

0 Likes