Skip to content

Instantly share code, notes, and snippets.

@5263
Created February 20, 2014 11:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 5263/9111947 to your computer and use it in GitHub Desktop.
Save 5263/9111947 to your computer and use it in GitHub Desktop.
exact representation of a FreeCAD placement
def hexplacement(plm):
fhex="*[float.fromhex(s) for s in %s]"
fstr="FreeCAD.Placement(FreeCAD.Vector(%s),FreeCAD.Rotation(%s))"
t=[f.hex() for f in plm.Base]
r=[f.hex() for f in plm.Rotation.Q]
return fstr % (fhex % t, fhex % r )
if __name__=='__main__':
import FreeCAD
print hexplacement(FreeCAD.Placement())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment