kisolre wrote: ↑
Thu May 02, 2019 4:42 pm
The sketch should not change its location at all. That is the whole point.
I'm a bit late on the fight, but as I promised, below is my proposal of macro (attached to this post).
First a simple example to ease further explanations (not an excellent example IMHO, but didn't found better one..
Let's suppose a simple cube whose top (yellow) face has been drafted. A cylinder is created with a padded circle whose sketch has been mapped (Flat face) to the drafted face and offset to match needs (Attachment offset)
Now for some reason, you need to revert the pull direction of the draft (of course without the cylinder to move). Here is what basically happen :
The treeview shows an error, the 3D view isn't updated, and the circle sketch is floating in the middle of nowhere...
Now comes the job of the macro (that you need to run before changing the reference face, when the sketch is still at its right place). Select the sketch and run it. If your sketch is in a body, a message box will ask to choose among 3 different options (if your sketch is out of a body, it will automatically apply the 1st one).
A copy of the macro header :
Code: Select all
# * "Raw" mode => the sketch placement is made absolute in the body referential, nothing more
# * "DP@Face mode" => a datum plane is created where the mapping face is, then the sketch is attached to it respecting its attachment offset
# * "DP@Sketch" mode => a datum place is created where the sketch is (including attachment offset), then the sketch is attached to its origin
And a picture for better understanding (right side view after macro running + draft reverted) :
Hope that helps. A next step could be to deal with multiple sketch selection, or whatever you think about. All feedbacks welcome.