How to fix Sketch orientation?
Forum rules
and Helpful information
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help
Also, be nice to others! Read the FreeCAD code of conduct!
Also, be nice to others! Read the FreeCAD code of conduct!
How to fix Sketch orientation?
I have this sketch, which is an extract from a bigger model which I made last year or so. The model now showed errors just on opening. I traced it to this sketch, which shows cumbersome behaviour:
- load the file
- edit the sketch
- switch to the model tab and make the sketch visible: You see that the orientation outside of sketcher is different from the (correct) orientation shown in sketcher. Recompute doesn't help.
How can I fix it?
- load the file
- edit the sketch
- switch to the model tab and make the sketch visible: You see that the orientation outside of sketcher is different from the (correct) orientation shown in sketcher. Recompute doesn't help.
How can I fix it?
- Attachments
-
- sketchOrientation.FCStd
- (3.83 KiB) Downloaded 29 times
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: How to fix Sketch orientation?
Is the sketch placement supposed to be:
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
-
- Veteran
- Posts: 5513
- Joined: Thu Apr 05, 2018 1:53 am
Re: How to fix Sketch orientation?
I remember NormandC remarking once how he never liked to leave sketches unattached. Perhaps issues like this is what he alluded to. If you attach it to something, and then adjust attachment offset to put it back where it was originally the problem disappears. I have 2 macros I use, based on work done by DeepSOIC and Kisolre. I call them phase1 and phase2 for lack of more imaginative names. Phase1 copies the current sketch placement. To use, select the sketch and run the macro. Next attach the sketch to something, anything, with any desired attachment mode. Then select the sketch again and run phase2. Phase2 modifies the attachment offset such that now the sketch is back in its original placement position.
In PD you could use the xy_plane, etc. In the attached file I added a cylinder to have something to compare the orientation of the sketch to. I attached the sketch concentrically to the top circle edge.
phase1:
phase2:
In PD you could use the xy_plane, etc. In the attached file I added a cylinder to have something to compare the orientation of the sketch to. I attached the sketch concentrically to the top circle edge.
phase1:
Code: Select all
#select the sketch to be reattached. Then run next two lines.
#from DeepSOIC and Kisolre
#part 1 of 2 sketch remapping
#in this part we simply get the current placement and save it
#the next phase is to manually attach the sketch to some desired object
#and then run phase 2, which will calculate the correct attachment offset to
#use with the new attachment to put the sketch back into the current location/rotation
sk = Gui.Selection.getSelection()[0]
FreeCAD.old_placement = sk.Placement
print ("Placement get from", sk.Label)
Code: Select all
#phase 2 now will calculate the attachment offset needed to put the sketch back where it was
#while at the same time remaining attached to the current object
#now, reattach the sketch, close attachment dialog. When done, run the rest of the script
sk = Gui.Selection.getSelection()[0]
att_plm = sk.Attacher.calculateAttachedPlacement(sk.Placement).multiply(sk.AttachmentOffset.inverse())
try:
att_offset = att_plm.inverse().multiply(FreeCAD.old_placement)
sk.AttachmentOffset = att_offset
print("Placement restored to ", sk.Label)
except:
print("use PlacementGet first")
- Attachments
-
- sketchOrientation_markster.FCStd
- (7.07 KiB) Downloaded 19 times
Re: How to fix Sketch orientation?
Yes, that's the correct placement. I recreated it in a new sketch with another obscurity: The angle of the placement is always rounded to 122.9° instead of 122.928.
I don't really remember how I did it then, I had created the model after after old technical drawings.
OS: macOS 10.16
Word size of FreeCAD: 64-bit
Version: 0.20.25311 (Git)
Build type: Release
Branch: master
Hash: c5524bb58a7126fa2242d6137eb82ee9d54e82d4
Python version: 3.9.6
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.5.2
Locale: C/Default (C)
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: How to fix Sketch orientation?
Been there, done that...
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
Re: How to fix Sketch orientation?
Here is an image made with an old 0.18 version. I would not like to upload the whole file because there are other errors too which I would like to fix. IIRC I had uploaded something to the Showcase forum.
- Attachments
-
- Bildschirmfoto 2021-08-03 um 18.36.28.png (542.73 KiB) Viewed 1071 times
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: How to fix Sketch orientation?
Thanks, that did the trick! I know we are of different opinions about the attach/not attach topic, but here your technique was very helpful .TheMarkster wrote: ↑Tue Aug 03, 2021 3:26 pm If you attach it to something, and then adjust attachment offset to put it back where it was originally the problem disappears.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: How to fix Sketch orientation?
Good evening to the Community!
.... I think that's okay too
.... I think that's okay too
- Attachments
-
- sketch_orientation_modify.gif (968.66 KiB) Viewed 1013 times
Re: How to fix Sketch orientation?
Thanks for your time and ideas. I got it fixed. Several primitives had changed their topo names, some sketches had flipped. Now only the exploded assembly is left to be fixed.
- Attachments
-
- SnipScreenshot-209ca8.png (78.52 KiB) Viewed 965 times
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: How to fix Sketch orientation?
This is what I use. It's the same code posted by DeepSOIC and Kisolre only I made it a one step process and put it in a easy to use Dialog, see pic. This will take any Sketch and change it's Support (to the selected) while preserving sketch location. By using this you can attach sketches to faces and then reattach them to standard planes. You loose parametrics but gain stability. I don't modify map mode.
There are some great uses to lock sketches to where the face is or was. Sketching on a face and then re-support the sketch can be a really good option if you need to keep something locked in place. For the new users, this will remove parametrics from the sketch attachment.
Edit: Check out that brake shoe, it's a 350 degree pad , I have never seen that before.
There are some great uses to lock sketches to where the face is or was. Sketching on a face and then re-support the sketch can be a really good option if you need to keep something locked in place. For the new users, this will remove parametrics from the sketch attachment.
Edit: Check out that brake shoe, it's a 350 degree pad , I have never seen that before.
- Attachments
-
- Renew_support1.FCMacro
- (5.07 KiB) Downloaded 20 times
-
- SUP_PIC.JPG (16.62 KiB) Viewed 942 times