Community
Meshmixer
Welcome to Autodesk’s Meshmixer Forums. Share your knowledge, ask questions, and explore popular Meshmixer topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Setting Extrude Offset value problems in mmapi

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
grahamJDGU9
395 Views, 2 Replies

Setting Extrude Offset value problems in mmapi

So I'm building a script that requires a step to extrude the frame of an object in mmapi, all my other steps in this script are working but this single function (single line in this function actually) refuses to work. I want to set offset to 3.5mm, however in this example offset will sometimes go to max mm (about 200mm and crash MeshMixer and my script), or it will go to a number around 3.5mm (such as 1.9-2.3mm or so), but I need to it be exactly 3.5mm. Does anyone have ideas on how to do this?  I have tried changing the values of offset, tried manually setting units with "offsetDistanceMm", tried finding a scaling factor. Any help is appretiated.

 

def extrudeFrame(r):
mm.select_all(r)
mm.begin_tool(r, "extrude")
mm.set_toolparam(r, "offset", 3.5)
mm.set_toolparam(r, "harden", 0.3)
mm.set_toolparam(r, "directionType", 0)
mm.set_toolparam(r, "preserveGroups", True)
mm.tool_utility_command(r, "update")
mm.accept_tool(r)
mm.cancel_tool(r)

 Thanks,

Tags (2)
2 REPLIES 2
Message 2 of 3
MagWeb
in reply to: grahamJDGU9

Inside its code MM uses a normalised coordinates system where the first object added to the scene defines a range of -1 to 1 for its largest XYZ-dimension "Scene Coordinates". A certain real world distance (e.g. 3.5mm) needs to be converted to that internal scene scale first.

 

import mmapi
from mmRemote import *
import mm

r = mmRemote()
r.connect()

off = mm.to_scene(r,3.5)

mm.select_all(r)
mm.begin_tool(r, "extrude")
mm.set_toolparam(r, "directionType", 0)
mm.set_toolparam(r, "offset", off)
mm.set_toolparam(r, "harden", 0.3)

mm.set_toolparam(r, "preserveGroups", True)
#mm.tool_utility_command(r, "update")
mm.accept_tool(r)
#mm.cancel_tool(r)

r.shutdown()

You need to use the update tool_utility_command only for tools which show an "Update" button.



Gunter Weber
Triangle Artisan

Message 3 of 3
grahamJDGU9
in reply to: MagWeb

It works perfectly thank you! I thought it was something like this but couldn't find any information on it. And thanks for the tips.

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

Post to forums  

Autodesk Design & Make Report