Convert spline to DWire (for offsetting)
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!
-
- Posts: 54
- Joined: Tue Jan 08, 2019 9:04 pm
Convert spline to DWire (for offsetting)
Here is my situation. I am working on designing a model plane with balsa/liteply construction. FreeCAD is handling the "hard" part of this -- 3D part creation -- just fine. Once I finish drawing the 3D parts, I need to have them laser cut. This means I need to convert to 2D, offset slightly to account for the width of the laser beam, and trim off some small sections of each part to keep them attached to the piece of wood once the cutting is done. I'm having issues with the offsetting part of this process. I'm finding that draft offset does not work for many of my parts. I believe this is because some of the edges are actually splines or derived from splines. It seems to work okay with DWires. So my question is, is it possible to convert a spline or other edge to a DWire automatically? Even better, if it can be done for a wire consisting of multiple edges, some of which may be splines. Alternatively, if there is another solution to my offsetting problem, that would be welcomed too. Otherwise, I may have to just bite the bullet and do these final steps in a different CAD tool better suited to 2D.
A sample file is attached, which contains a single wire that I am not able to offset. I am using the official FreeCAD 0.18 AppImage on Slackware. Thanks in advance for your help.
A sample file is attached, which contains a single wire that I am not able to offset. I am using the official FreeCAD 0.18 AppImage on Slackware. Thanks in advance for your help.
- Attachments
-
- test.FCStd
- (3.66 KiB) Downloaded 44 times
Re: Convert spline to DWire (for offsetting)
The problem is not the BSplines.
The shape in the test file is a compound of individual edges, it is not a wire.
You need to Draft->Upgrade it to a wire.
The shape in the test file is a compound of individual edges, it is not a wire.
You need to Draft->Upgrade it to a wire.
-
- Posts: 54
- Joined: Tue Jan 08, 2019 9:04 pm
Re: Convert spline to DWire (for offsetting)
Does the offset work for you after upgrading it? I still get this error:
Code: Select all
the offset tool is currently unable to offset a non-Draft object directly - Creating a copy
('[Draft.todo.commit] Unexpected error:', <class 'AttributeError'>, 'in ', ['Draft.offset(FreeCAD.ActiveDocument.Wire,FreeCAD.Vector(56.91583887605228,2.6645352591003757e-15,0.0),copy=False,occ=False)', 'FreeCAD.ActiveDocument.recompute()'])
Re: Convert spline to DWire (for offsetting)
Part->Offset2D works.
Draft->Offset doesn't.
Draft->Offset doesn't.
-
- Posts: 54
- Joined: Tue Jan 08, 2019 9:04 pm
Re: Convert spline to DWire (for offsetting)
Thanks! I hadn't noticed the Part -> Offset2D function. It almost does what I need. The only problem is that after offsetting, sharp corners are now rounded. I need them to remain sharp. I've tried the different Join Type options, but unfortunately Arc is the only one that results in a valid offset. Any ideas?
- Attachments
-
- offset.png (38.18 KiB) Viewed 1639 times
-
- Posts: 54
- Joined: Tue Jan 08, 2019 9:04 pm
Re: Convert spline to DWire (for offsetting)
Well, if there is no solution to the rounded corners issue, unfortunately it looks like I will probably switch to another CAD program for this operation. I do think my original idea of converting everything to DWires would work, because draft offset with DWires works fine and does not round corners. But for now, I think I will take the path of least resistance.
Re: Convert spline to DWire (for offsetting)
Did you try all the options of Draft Offset? This tool is a particular implementation of internal commands, like DraftGeomUtils.offsetWire().montagdude wrote: ↑Wed Sep 25, 2019 7:26 pm Well, if there is no solution to the rounded corners issue, ...
But not all options are readily available for the graphical interface. In some cases you need to call the functions from the command line.
For example, Draft.offset() seems to call this function
Code: Select all
DraftGeomUtils.offsetWire(obj.Shape, delta, occ=True)
Internally, offsetWire() seems to call Part.Wire.makeOffset() in some cases, and DraftGeomUtils.offset() in others.
The geometry probably can be offset correctly, but the right options are hard to track.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
-
- Veteran
- Posts: 5513
- Joined: Thu Apr 05, 2018 1:53 am
Re: Convert spline to DWire (for offsetting)
Part 2d offset has an Intersection option (instead of Arc) that will give squared corners instead of rounded ones.montagdude wrote: ↑Wed Sep 25, 2019 7:26 pm Well, if there is no solution to the rounded corners issue, unfortunately it looks like I will probably switch to another CAD program for this operation. I do think my original idea of converting everything to DWires would work, because draft offset with DWires works fine and does not round corners. But for now, I think I will take the path of least resistance.
-
- Posts: 54
- Joined: Tue Jan 08, 2019 9:04 pm
Re: Convert spline to DWire (for offsetting)
I did try all the GUI options, but I haven't tried messing with the python commands. Thanks for the tip. I'll try and report back if I can get it to work.vocx wrote: ↑Wed Sep 25, 2019 9:10 pmDid you try all the options of Draft Offset? This tool is a particular implementation of internal commands, like DraftGeomUtils.offsetWire().montagdude wrote: ↑Wed Sep 25, 2019 7:26 pm Well, if there is no solution to the rounded corners issue, ...
But not all options are readily available for the graphical interface. In some cases you need to call the functions from the command line.
For example, Draft.offset() seems to call this functionMaybe setting occ=False would work.Code: Select all
DraftGeomUtils.offsetWire(obj.Shape, delta, occ=True)
Internally, offsetWire() seems to call Part.Wire.makeOffset() in some cases, and DraftGeomUtils.offset() in others.
The geometry probably can be offset correctly, but the right options are hard to track.
-
- Posts: 54
- Joined: Tue Jan 08, 2019 9:04 pm
Re: Convert spline to DWire (for offsetting)
Yes, as I mentioned, only Arc gives me a valid offset. All the other options and combination of options result in either nothing or only a small segment.TheMarkster wrote: ↑Thu Sep 26, 2019 12:19 amPart 2d offset has an Intersection option (instead of Arc) that will give squared corners instead of rounded ones.montagdude wrote: ↑Wed Sep 25, 2019 7:26 pm Well, if there is no solution to the rounded corners issue, unfortunately it looks like I will probably switch to another CAD program for this operation. I do think my original idea of converting everything to DWires would work, because draft offset with DWires works fine and does not round corners. But for now, I think I will take the path of least resistance.