[SOLVED] Setting sketch placement

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
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!
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

[SOLVED] Setting sketch placement

Post by Joel_graff »

When sweeping a sketch along an edge, is there a way to automatically align the sketch to the edge? By that, I don't just mean rotation (Part::Sweep appears to do that automatically). I mean, position the sketch such that it is coincident with the sweep path/edge, even if, prior to the sweep, the two are nowhere near each other.

The best I can figure is to do it in Python using the Placement property. However, I'm not quite sure how to go about that...
Last edited by Joel_graff on Fri Nov 02, 2018 5:32 pm, edited 1 time in total.
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
TheMarkster
Veteran
Posts: 5513
Joined: Thu Apr 05, 2018 1:53 am

Re: Setting sketch placement

Post by TheMarkster »

You can attach the sketch to the edge. I'd have to see your model to say exactly how to go about doing it.
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Setting sketch placement

Post by Joel_graff »

TheMarkster wrote: Fri Oct 05, 2018 7:26 pm You can attach the sketch to the edge. I'd have to see your model to say exactly how to go about doing it.
That's the tricky part. I want to be able to sweep a sketch along an edge with arbitrary starting and stopping points. Since that isn't supported, I need to generate my own edge based on those positions and sweep the sketch along it, instead. Further, I anticipate the sketch will be auto-generated or possibly imported from another file, so I'm writing a custom tool to do all of this.

In other words, prior to the sweep, the sweep path doesn't exist and the sketch is arbitrarily placed in the 3D environment. To that point, I had planned on treating the sketch's origin as the point that's always attached to the generated edge to help simplify matters. Thus, hopefully, all I need to do is create a new placement for the sketch... unless there's another way to auto-align the two in a separate operation before sweeping.
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
oldmachine
Posts: 243
Joined: Wed May 31, 2017 11:49 pm

Re: Setting sketch placement

Post by oldmachine »

Not sure if this is going to help but, it may lead to further 'inventive' ideas..
Joel_graff wrote: Fri Oct 05, 2018 7:09 pm is there a way to automatically align the sketch to the edge?
Consider the attached: Wherever the part containing the edge is, create Datums for the Sweep Sections and Path.

This example is for a Homemade Variable Radius (PartDesign does not have Variable Radius).
One Radius, Lofts one section to another of smaller radius's sketch.

The other Radius uses a Multi-Section Sweep along a Path. The Path was sketched using the existing edge (I think this is what you're interested in). The Icon/Tool in Sketch is "Create an Edge Linked to existing geometry"

[corrected typo]
Last edited by oldmachine on Fri Oct 05, 2018 8:36 pm, edited 2 times in total.
MAC OSX Sierra
3D Parts & Links (made using FreeCad and Solidworks): https://www.thingiverse.com/Still_Breathing/designs
Android App & Links: https://play.google.com/store/apps/deta ... .bestknots
User avatar
Willem
Veteran
Posts: 1854
Joined: Fri Aug 12, 2016 3:27 pm
Location: Lisse, The Netherlands

Re: Setting sketch placement

Post by Willem »

I am not sure or it does what you want but try the macro solid sweep
User avatar
Willem
Veteran
Posts: 1854
Joined: Fri Aug 12, 2016 3:27 pm
Location: Lisse, The Netherlands

Re: Setting sketch placement

Post by Willem »

Working with Datum point, Datum line and Datum plane can be the solution
phpBB [video]
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Setting sketch placement

Post by Joel_graff »

oldmachine wrote: Fri Oct 05, 2018 8:22 pm Consider the attached: Wherever the part containing the edge is, create Datums for the Sweep Sections and Path.
I don't see an attachment, unfortunately...
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Setting sketch placement

Post by Joel_graff »

Willem wrote: Fri Oct 05, 2018 11:00 pm Working with Datum point, Datum line and Datum plane can be the solution
Thanks for the video, but I'm still not certain how it helps.

Perhaps I could rephrase my question:

Could I use datum planes to arbitrarily control the starting and ending positions of a sweep along the sweep path?

If I can't specify the exact starting and ending points of a sweep along a given path of one or more edges, then I need to copy the portions of the path that I want the sweep to follow as separate edges, and use those edges exclusively for the sweep.
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Setting sketch placement

Post by Joel_graff »

Ok, so I've been working on this a bit more, and I think I'm close, but I still have some gaps in my understanding of manipulating a sketch via it's placement.

So in the atached file, I have a body which contains two sketches: the sweep path (Sketch) and the template to be swept (Sketch001).

In the python console, I've successfully oriented the sketch using the MapMode and Support properties to the arc in the sweep path.

However, I need to take the last step and position the sketch at the starting point of the sweep path. In the case of this example, the arc's "first" vertex is actually between the arc and line, but that's an issue I can address later.

Right now, I need to figure out how to set the position of the second sketch given a point of an edge in the first sketch.
Attachments
test.FCStd
(6.44 KiB) Downloaded 51 times
Capture.JPG
Capture.JPG (28.97 KiB) Viewed 2610 times
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
chrisb
Veteran
Posts: 54207
Joined: Tue Mar 17, 2015 9:14 am

Re: Setting sketch placement

Post by chrisb »

Here some proposals to extend the sweep tools: https://forum.freecadweb.org/viewtopic.php?f=8&t=31610
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Post Reply