Community
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.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

To scale sketch.

5 REPLIES 5
Reply
Message 1 of 6
Anonymous
824 Views, 5 Replies

To scale sketch.

Good day.

I need to scale my sketch.

When I use this code:

 

contour = rootComponent.sketches.item(0)
scales = rootComponent.features.scaleFeatures
scaleFactor = adsk.core.ValueInput.createByReal(1.4)
inputEntity = adsk.core.ObjectCollection.create()
inputEntity.add(contour)
basePt = contour.sketchPoints.item(0)
scaleUniformInput = scales.createInput(inputEntity, basePt, scaleFactor)
scaleUniform = scales.add(scaleUniformInput)

I want to scale sketch in 140%, but I get sketch consists from two parts. First is the same sketch, second is much bigger than 140%.  In UI Scale  value 1.4 works correctly.

What I have to do for getting only resulting sketch, and what I have to set ValueInput to zoom sketch in 140%?

Also, there is no way to scale meshbody, is there?

5 REPLIES 5
Message 2 of 6
ekinsb
in reply to: Anonymous

I just tested your code with the current release and don't see the same behavior that you're describing although I do see a different problem where the resulting scaled sketch doesn't result in a profile.  I get the same behavior when I do the scale interactively.  I also tested it using latest update which is scheduled to go live this weekend, (except for the Mac App Store version, which will be a bit later).  Anyway, with this version I get a good result, so it looks like some fixes have been made in the scale feature.  I suggest waiting for the update this weekend and see if that solves the problem you're having.


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Message 3 of 6
Anonymous
in reply to: ekinsb

Thank you. You are completely right. It works correctly with new update.

 

Please, suggest me, are there methods to scale and/or move meshbody? Similar to methods for sketch.

 

Message 4 of 6
ekinsb
in reply to: Anonymous

That's great news.  Thanks for letting me know.


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Message 5 of 6
ekinsb
in reply to: Anonymous

And regarding your other question about scaling and moving meshbodies; Fusion only supports the manipulation of mesh bodies in non-parametric environments.  That is you can only import and manipluate mesh bodies if the document is set to not capture design history, the mesh is in a base feature within a parametric design, or the mesh is in a form feature.  The API does support the first of the three because you can work in a document that id not capturing design history, however when I try to create a move or scale feature on the mesh body I don't get any errors but the mesh body is not changing either.  I'll log a defect for this.

 

For the case where the mesh body exists within a form or base feature, we still need more API to be able to manipulate anything that's owned by either of those features.


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Message 6 of 6
ekinsb
in reply to: ekinsb

I have to take one thing back that I said.  The Scale feature is working as expected on a mesh body.  In my original test, the mesh body I created was in a base feature, not in a regular component.  When I created the mesh in a regular component within a non-parametric design, scale is working.  Move still isn't working and I'll log a bug for that.


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog

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

Post to forums  

Autodesk Design & Make Report