Merge Sketches is distorting the sketches

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!
ChrisFC
Posts: 27
Joined: Mon Jul 26, 2021 8:30 am

Re: Merge Sketches is distorting the sketches

Post by ChrisFC »

TheMarkster wrote: Wed Dec 08, 2021 12:20 am One more update, can't resist adding more features, it seems.

New version: 0.2021.12.7.rev4

New properties:

Vertex1Offset, Vertex2Offset, Vertex3Offset -- allow to independently adjust the position of the vertices.
Mirror -- mirror the arc and show both the original and the mirror (mirrored about the center)
MirrorOnly -- show only the mirror, not the original
Hi @TheMarkster, thank you very much for this, it is doing what I want! My only question is how do I go about extending the surface between the two curves so that it does not terminate at the arcs?

"Value1, Value2 -- allows to extend arc beyond vertex1 and vertex3". Sorry, I am fairly new to FreeCAD still. I have made a button to execute the macro and it is working well. How do I use Value1 and Value2 in this context?

Cheers and many thanks for the help!
Chris
ChrisFC
Posts: 27
Joined: Mon Jul 26, 2021 8:30 am

Re: Merge Sketches is distorting the sketches

Post by ChrisFC »

Edit: After playing around with the extrapolate surface utility in the surface workbench I was able to extend this surface with easy past the bounds of these 2 arcs, and have been able to complete the setup of the model exactly as how I would like. Thank you very much once again for your help and to the others in this thread also!

Cheers,
Chris
domad
Veteran
Posts: 2055
Joined: Mon Jun 22, 2020 12:16 pm

Re: Merge Sketches is distorting the sketches

Post by domad »

Hi ChrisFC, hello to the community!
... I don't know if this can suit your needs, the parameters of the sketchs inserted in the spreadsheet are partial, it is however possible to insert them all.
By modifying the values in the green cells it is possible to dynamically modulate the creation of the curved surfaces, furthermore it is possible to visually verify the correct creation of the solid, otherwise you will not get the external closing surfaces.
Attachments
FREECAD_FORUMS_CHRISFC_HELP-3.FCStd
(20.98 KiB) Downloaded 17 times
FREECAD_FORUMS_CHRISFC_HELP-3.png
FREECAD_FORUMS_CHRISFC_HELP-3.png (149.37 KiB) Viewed 1051 times
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: Merge Sketches is distorting the sketches

Post by TheMarkster »

ChrisFC wrote: Wed Dec 08, 2021 9:56 am Edit: After playing around with the extrapolate surface utility in the surface workbench I was able to extend this surface with easy past the bounds of these 2 arcs, and have been able to complete the setup of the model exactly as how I would like. Thank you very much once again for your help and to the others in this thread also!

Cheers,
Chris
I added another feature, to make a face from the arc and to show the full circle instead of only the arc, if desired.

Newest version: 0.2021.12.8

I'm glad you have it working to your satisfaction. The Value1 and Value2 properties move the ends of the arc along the arc. This could probably be done with angles instead, or perhaps converted to angles. A value of 2 * pi is a full circle, so these are in radians. It's the angle in radians from the original vertex positions. But it still sometimes inverts the arc unexpectedly. There's probably a point where it crosses the circle's 0 degree position, and that causes the flipping. I'm not sure.
Attachments
parametricarc.py
(7.52 KiB) Downloaded 16 times
ChrisFC
Posts: 27
Joined: Mon Jul 26, 2021 8:30 am

Re: Merge Sketches is distorting the sketches

Post by ChrisFC »

Thanks once again!

I realised after sleeping on the problem that I hadn't quite gotten things 100% correctly pictured in my mind (what was produced by you guys was 100% accurate to what I was describing!, I just realised later that I'd slightly missed something). Essentially I realised that points A and B are not exactly what they need to be. If one looks at the end face that is provided, it is essentially a surface of some thickness and 2 horizontally running, parallel edges (kind of like a rail). I realised that when one makes the central cross section thickness larger, one moves point B around, and that this results in point B moving inward/outward in R (where R is sqrt(xx+yy)). This is fine, however, I realised that if B moves to a new R value, A and C need to also move such that whilst remaining on the rail, they follow the same R value as B. The truth is that the 'end face' I provided is actually not the true end face of the component, rather, it's a helpful section of the actual end face of the component that helps me to orient the guiding rail correctly in space. I didn't realise at the time that using the end point of said rail is actually incorrect, as mentioned, due to said end point not following the same R value of B.

What I have been doing today is to make a ruled plane between the 'guiding rail' (done) and extending it outward (done). However, I've been struggling to convert it into a sketch, such that I can define a new point A' somewhere on said guiding rail (as opposed to A just being the end point of the rail). I've also had thoughts of skipping this step of making the end face into a sketch, and just making a draft(?) point, and somehow (without the need to make a sketch), fix the point to always lie on the rail, whilst following a rule on its value of R (hence setting its x and y and hence position along said edge).

This new point (let's call it A' and C') would then be the ones that I make the arc through (which by the way has been working absolutely as intended, thank you!).
Hope that was clear

Edit: Another way to look at this is to say that there is some cylinder centred on the Z axis with B on said cylinder, that intersects the guiding rail, at which point the new point A' would be defined.

Cheers,
Chris
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: Merge Sketches is distorting the sketches

Post by TheMarkster »

You can attach a part::vertex (made in part workbench -> create primitives dialog) to an edge, z tangent to edge / normal to edge. Then set its MapPathParameter to some value between 0 (start of edge), 0.5 (middle of edge), 1.0 (end of edge) or use values greater than 1 or less than 0 to position the vertex along the edge.
ChrisFC
Posts: 27
Joined: Mon Jul 26, 2021 8:30 am

Re: Merge Sketches is distorting the sketches

Post by ChrisFC »

Hi! Sorry I'm not sure I follow. When I go into this menu and make a point, it only asks where in space I want to put it, there is no option in this dialog box for attachment as far as I can see?

Edit: nevermind I found out how to attach to the edge!

I now have an additional question. If I implement a rule wherein I define a quantity R = sqrt(xx+yy), will it be possible to input some R value (though in the future this will be itself determined by another point's R value) such that the point automatically adjusts itself along the line to follow this rule, or do I need to modify such a rule as to define specifically the MapPathParameter?
ChrisFC
Posts: 27
Joined: Mon Jul 26, 2021 8:30 am

Re: Merge Sketches is distorting the sketches

Post by ChrisFC »

Update:

I have had some success, and think that I am close to a solution!

I have produced a cylinder of the same radius as the target point B, shown below. I now simply need to find the point wherein the highlighted edge intersects with the face of the cylinder:
Screenshot from 2021-12-10 14-54-43.png
Screenshot from 2021-12-10 14-54-43.png (97.99 KiB) Viewed 844 times
I have made a vertex that I want to both constraint to be on said edge and on the face of the cylinder (hence it would be the point where the 2 intersect). My previous attempts have worked in getting the point onto the edge, but not also onto the face of the cylinder. The attachment dialog box is shown in the above, and when I try to select both the curve and the cylinder, I get the error:

Code: Select all

14:47:57  PositionBySupport: AttachEngine::getInertialPropsOfShape: provided shapes are incompatible (not only edges/wires)
Any thoughts? pretty sure this should be the last step before the model is complete

Cheers,
Chris
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: Merge Sketches is distorting the sketches

Post by TheMarkster »

There is no attachment mode to support a vertex on an edge and on a different face. But in the sketcher you could create a link to external geometry for the edge and another for the edge that defines the face. Add a point object to the sketch and constrain it to both objects. Use reference mode constraints to get the x and y positions of the point. Use another sketch rotated 90 degrees to get the z position. Name all constraints, example: xpos, ypos, zpos and reference them as Sketch.Constraints.xpos, etc.

In this file I added a local coordinate system to attach the sketches to, but I don't think this is strictly necessary. Create the sketch in sketcher and don't attach to anything. Select xy plane for one and xz or yz for the other to get the zpos from it.

To add the LCS in the python console enter:

Code: Select all

FreeCAD.ActiveDocument.addObject("PartDesign::CoordinateSystem,"LCS")
Snip macro screenshot-35c506.png
Snip macro screenshot-35c506.png (75.65 KiB) Viewed 823 times
Attachments
parametric_arc_example.FCStd
(9.15 KiB) Downloaded 14 times
ChrisFC
Posts: 27
Joined: Mon Jul 26, 2021 8:30 am

Re: Merge Sketches is distorting the sketches

Post by ChrisFC »

TheMarkster wrote: Fri Dec 10, 2021 4:10 pm There is no attachment mode to support a vertex on an edge and on a different face. But in the sketcher you could create a link to external geometry for the edge and another for the edge that defines the face. Add a point object to the sketch and constrain it to both objects. Use reference mode constraints to get the x and y positions of the point. Use another sketch rotated 90 degrees to get the z position. Name all constraints, example: xpos, ypos, zpos and reference them as Sketch.Constraints.xpos, etc.

In this file I added a local coordinate system to attach the sketches to, but I don't think this is strictly necessary. Create the sketch in sketcher and don't attach to anything. Select xy plane for one and xz or yz for the other to get the zpos from it.

To add the LCS in the python console enter:

Code: Select all

FreeCAD.ActiveDocument.addObject("PartDesign::CoordinateSystem,"LCS")
Snip macro screenshot-35c506.png
Hi TheMarkster!

Thank you for the reply. I actual just solved my issue with these points by instead just solving the relevant geometry equations for the intersection of a cylinder and a line using the spreadsheets, which was really cool as the points now move as the radius increases, without having to attach them to the edges at all.

However, your parametric arc macro now no longer seems to work. When I select the 3 points (2 vertexes defined by the geometry equations and the 1 vertex in the middle cross section) it now no longer makes the arc, instead creating an empty part called ParametricArc?
Screenshot from 2021-12-10 20-39-02.png
Screenshot from 2021-12-10 20-39-02.png (36.06 KiB) Viewed 771 times
Screenshot from 2021-12-10 20-39-44.png
Screenshot from 2021-12-10 20-39-44.png (50.48 KiB) Viewed 771 times
Any thoughts on this?

Cheers,
Chris
Post Reply