..."Sketch").Placement; ..Revolution.Placement

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
E Guerra
Posts: 8
Joined: Tue Sep 08, 2015 4:50 pm

..."Sketch").Placement; ..Revolution.Placement

Post by E Guerra »

hello
trying to code the generation and placement of a revolved object from a sketch
tried coding a few different ways
1. generated the sketch[ok], used placement to move[ok], then used revolution, did not work, when sketch moved back to original position, revolved part appeared

2. generated the sketch[ok], used revolution[ok], then used placement on sketch, did not work, [sketch moved, but revolved part stayed put], had to used placement on the revolved part also
both the sketch and the revolved part have some type of error[red exclamation point]

also tried cutting a previous solid[box], with the revolved part, got an error message about: an OCC exception occurred [no other details] and that the resulting solid would not be created. a solid was created with a hole[as wanted] but the sketch and revolved part still had errors which i cannot figure out what they are

does revolution only work along a major axis?
must a sketch and revolved part be moved together as detailed above?
using the python console and report view, but no errors were printed on either
are those errors logged? or available somewhere?
MarmotCAD
Posts: 23
Joined: Thu Feb 18, 2016 6:31 pm

Re: ..."Sketch").Placement; ..Revolution.Placement

Post by MarmotCAD »

Try this..

Code: Select all


doc=FreeCAD.newDocument()
box=doc.AddObject("Part::Box","myBox")
doc.recompute()
App.getDocument("Unnamed").myBox.Placement=App.Placement(App.Vector(0,0,0),App.Rotation(App.Vector(0,0,1),25),App.Vector(0,0,0))

The first vector defines any translation. The second vector defines your axis of rotation, followed by your degrees of rotation. The last vector identifies the origin of your axis of rotation.

Hope this helps.
Post Reply