Feature: offset tool in sketcher
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Re: Feature: offset tool in sketcher
Good point. This would fulfil another longterm requirement.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: Feature: offset tool in sketcher
Thanks for the macro.
If Ican suggest something I like to see a option to make the offset lines conected with the same contraints from the original lines, and some system to make the offset parametric, for example with reference lines between original and offset.
If Ican suggest something I like to see a option to make the offset lines conected with the same contraints from the original lines, and some system to make the offset parametric, for example with reference lines between original and offset.
- Attachments
-
- offset constraints.FCStd
- (12.35 KiB) Downloaded 63 times
-
- captura offset constraints.png (24.66 KiB) Viewed 2728 times
Re: Feature: offset tool in sketcher
@Rana and bleber: I have recorded this desire. I think it will be possible, because the offset lines are calculated.
Re: Feature: offset tool in sketcher
Attached you will find the new version 2.0 of the script.
New benefits:
- The offset chain is constrained
- Reference geometry is included
Keeping the offset feature you can:
- drag the figure with the mouse
- modify measures or create new measures
- load the sript into the python console
- open a sketch and select a chain of lines and arcs
- start the script
Warning: Depending on the constraints in the source sketch, redundant constraints may occur. You have to delete them manually.
Please tell me problems, bugs, desires, comments ...
New benefits:
- The offset chain is constrained
- Reference geometry is included
Keeping the offset feature you can:
- drag the figure with the mouse
- modify measures or create new measures
I did not work on the selection problem till now. So the workflow has to be:The issue arises after calling the macro: the selection is lost. If I select the lines after opening the dialog, the dialog hides behind the main FreeCAD window (perhaps again a MacOS issue).
- load the sript into the python console
- open a sketch and select a chain of lines and arcs
- start the script
Warning: Depending on the constraints in the source sketch, redundant constraints may occur. You have to delete them manually.
Please tell me problems, bugs, desires, comments ...
- Attachments
-
- OffsetInSketcher02.FCMacro
- (12.78 KiB) Downloaded 117 times
- Pauvres_honteux
- Posts: 728
- Joined: Sun Feb 16, 2014 12:05 am
- Location: Far side of the moon
Re: Feature: offset tool in sketcher
Tested your macro on:
OS: openSUSE Leap 15.1 (KDE//usr/share/xsessions/default)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.Unknown
Build type: Release
Python version: 3.6.5
Qt version: 5.9.7
Coin version: 4.0.0
OCC version: 7.4.0
... and got this:
.
I made one sketch containing a rectangle with a radius "dent" in it, then I mad a new one on the same plane as the first one while projecting/linking lines and arcs from the first one. Then executed your "OffsetInSketcher02.FCMacro", then selected the top line and continued around in a clock-wise fashion, then clicked on OK, see picture.
. .
The purpose of this test was to see if it could handle a disappearing radius (which it must handle [if radius < = 0 then ....] ).
I also noticed it didn't ask for which side it should offset it to.
It would be nice with an arrow in the 3D-viewport to click on, for that purpose.
And on top of all: this is a must-have in FC-master!
OS: openSUSE Leap 15.1 (KDE//usr/share/xsessions/default)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.Unknown
Build type: Release
Python version: 3.6.5
Qt version: 5.9.7
Coin version: 4.0.0
OCC version: 7.4.0
... and got this:
Code: Select all
Report view:
13:40:48 Traceback (most recent call last):
13:40:48 File "/home/drega_soid/.FreeCAD/Macro/OffsetInSketcher02.FCMacro", line 119, in calculate
13:40:48 OffsetInSketcher.calculate(OffsetValue) # do the calculation
13:40:48 File "/home/drega_soid/.FreeCAD/Macro/OffsetInSketcher02.FCMacro", line 362, in calculate
13:40:48 SortedEdges = interlinkedEdges(linesAndArcs()) # list of interlinked lines and arcs S0-E0,S1-E1, ...
13:40:48 File "/home/drega_soid/.FreeCAD/Macro/OffsetInSketcher02.FCMacro", line 202, in interlinkedEdges
13:40:48 SortedEdges.append(UnsortedEdges.pop(0)) # first element in UnsortedEdges list
13:40:48 IndexError: pop from empty list
Python console:
Python 3.6.10 (default, Jan 16 2020, 09:12:04) [GCC] on linux
Type 'help', 'copyright', 'credits' or 'license' for more information.
>>> Gui.runCommand('Std_RecentMacros',0)
>>> # Gui.Selection.addSelection('Unnamed','Sketch001','ExternalEdge1',3.58656,-0.00800119,10,False)
>>> # Gui.Selection.addSelection('Unnamed','Sketch001','ExternalEdge2',10,-0.00800082,6.87427,False)
>>> # Gui.Selection.addSelection('Unnamed','Sketch001','ExternalEdge3',8.30448,-0.00799899,-8.46927,False)
>>> # Gui.Selection.addSelection('Unnamed','Sketch001','ExternalEdge4',10,-0.00799815,-15.5681,False)
>>> # Gui.Selection.addSelection('Unnamed','Sketch001','ExternalEdge5',7.18999,-0.00799762,-20,False)
>>> # Gui.Selection.addSelection('Unnamed','Sketch001','ExternalEdge6',-15,-0.00799868,-11.0796,False)
>>>
I made one sketch containing a rectangle with a radius "dent" in it, then I mad a new one on the same plane as the first one while projecting/linking lines and arcs from the first one. Then executed your "OffsetInSketcher02.FCMacro", then selected the top line and continued around in a clock-wise fashion, then clicked on OK, see picture.
. .
The purpose of this test was to see if it could handle a disappearing radius (which it must handle [if radius < = 0 then ....] ).
I also noticed it didn't ask for which side it should offset it to.
It would be nice with an arrow in the 3D-viewport to click on, for that purpose.
And on top of all: this is a must-have in FC-master!
Re: Feature: offset tool in sketcher
I'm not sure about the must have respecting radii<0, because I don't know what the outcome should be. So as a simple solution such request could be rejected.
The side of the offset is determined by the orientation of the first line (see post above), a negative offset switches sides.
The side of the offset is determined by the orientation of the first line (see post above), a negative offset switches sides.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: Feature: offset tool in sketcher
@Pauvres_honteux: thanks for testing, but sorry, the case you tested is not implemented yet.
Please respect the constraints (see post above):
- all selected lines must form one continous line (if not, only the lines connected to the first created line will be taken)
You can create your figure in the following way (but without having the full parametric):
- select all lines except the arc
- run the script
- select only the arc
- run the script
- connect the two offset figures manually (see attached example)
Please respect the constraints (see post above):
The third constraint should be better:- the selected lines may be an open or a closed line chain (see examples)
- the offset value may be a positive or a negative float value
- all selected lines must form one zigzag line (if not, only the first line will be taken)
- arcs are allowed, but must be tangential to their nearby objects (as if using the M-button in the CreatePolyline command)
- all selected lines must form one continous line (if not, only the lines connected to the first created line will be taken)
You can create your figure in the following way (but without having the full parametric):
- select all lines except the arc
- run the script
- select only the arc
- run the script
- connect the two offset figures manually (see attached example)
- Attachments
-
- OffsetExample.FCStd
- example for Pauvres_honteux
- (13.75 KiB) Downloaded 67 times
Re: Feature: offset tool in sketcher
This works very well now!
I have some suggestions concerning the constraints:
Instead of using orthogonal plus point-on-object you could use the variant orthogonal point-on-line
If such construction geometry is created manually it is usually placed at the end of one of the lines. You can then replace the point-on-object constraint by a coincidence.
If you really want to position the construction lines in the middle of the lines use a symmetry constraint. Please note that this implies the point-on-object constraint.
Let me know if you need an example of my suggestions.
I have some suggestions concerning the constraints:
Instead of using orthogonal plus point-on-object you could use the variant orthogonal point-on-line
If such construction geometry is created manually it is usually placed at the end of one of the lines. You can then replace the point-on-object constraint by a coincidence.
If you really want to position the construction lines in the middle of the lines use a symmetry constraint. Please note that this implies the point-on-object constraint.
Let me know if you need an example of my suggestions.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: Feature: offset tool in sketcher
You probably mean the Python editor. For me the workaround is
- start the macro; a dialog is opened
- select the geometric elements
- bring the dialog to front and start it.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
- Pauvres_honteux
- Posts: 728
- Joined: Sun Feb 16, 2014 12:05 am
- Location: Far side of the moon
Re: Feature: offset tool in sketcher
.
What I was phishing for was If you had it on your to-do-list. Since you typed "is not implemented yet" my lightbulb didn't go out anyway.
Jokes aside, the use case I showed is real and used alot in the industri by us pro's.
.
Of course I understand programing take its time, so to just have the feature request firmly on your radar is already a big step forward, in my opinion.
Last edited by Pauvres_honteux on Wed Sep 16, 2020 5:02 pm, edited 1 time in total.