Feature request : round corner rectangle
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Re: Feature request : round corner rectangle
Nice Macro. I updated the interface a little bit to be more consistent with the Freecad UI.
I also fixed the constrained Circle that had a typo in the parameter.
I was not able to change the constraints to use the diagonal symmetry yet. I didn't have much time to understand the methods yet.
It is attached here if one of you knows how to improve the constraints. I would be glad to have the best constraints applied.
I changed it to use the constraint by default as chrisb said, which I think is a valid decision. I also fixed the constrained Circle that had a typo in the parameter.
I was not able to change the constraints to use the diagonal symmetry yet. I didn't have much time to understand the methods yet.
It is attached here if one of you knows how to improve the constraints. I would be glad to have the best constraints applied.
Re: Feature request : round corner rectangle
Attached you will find a revised version of the script, considering all wishes remarked till now.
There is a new interface applied, shown in the combo view. Please give me further desires and comments.
There is a new interface applied, shown in the combo view. Please give me further desires and comments.
Re: Feature request : round corner rectangle
I just discovered this nice macro!
I think it should be included inside the FC main code or at least available in the Addons Macro list.
Re: Feature request : round corner rectangle
Nice macro, so please see my comment as envcouragement and not as negative criticism.
I wonder if it is possible to center the figures around an arbitrary point, not just the origin. The workflow would be:
- if a point is selected, then the figure uses this point as center
- if nothing is selected, the origin is used
- if something else is selected raise an error
Furthermore I found that switching between models is not possible without restarting the model. I did the following:
- open two files with sketches in them
- open sketch in first model
- run the macro; it installs a third tab Centered Figures besides Model and Tasks
- create a figure with the macro; it will be correctly created in the sketch
- switch to the Tasks tab and close the sketch.
- Switch to the other model
- open the sketch in that model
- create a figure; this seems natural, as the additional tab still exists
- it seems as if nothing has happened; in fact another figure is added to the existing sketch in the first model.
I wonder if it is possible to center the figures around an arbitrary point, not just the origin. The workflow would be:
- if a point is selected, then the figure uses this point as center
- if nothing is selected, the origin is used
- if something else is selected raise an error
Furthermore I found that switching between models is not possible without restarting the model. I did the following:
- open two files with sketches in them
- open sketch in first model
- run the macro; it installs a third tab Centered Figures besides Model and Tasks
- create a figure with the macro; it will be correctly created in the sketch
- switch to the Tasks tab and close the sketch.
- Switch to the other model
- open the sketch in that model
- create a figure; this seems natural, as the additional tab still exists
- it seems as if nothing has happened; in fact another figure is added to the existing sketch in the first model.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: Feature request : round corner rectangle
I can very well imagine to use these macros to extend an existing sketch. However, this fails, because the constraints are applied to the wrong elements:
- create a sketch with a circle
- use the macro to add a centered rectangle Result:
- the circle gets a forbidden horizontal constraint
- the constraints of the rectangle are out of whack
If I create manually a rectangle and add then the macro the dimensions are added to the wrong rectangle. If I move the first rectangle it snaps to the center.
- create a sketch with a circle
- use the macro to add a centered rectangle Result:
- the circle gets a forbidden horizontal constraint
- the constraints of the rectangle are out of whack
If I create manually a rectangle and add then the macro the dimensions are added to the wrong rectangle. If I move the first rectangle it snaps to the center.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: Feature request : round corner rectangle
And a final remark: It is recommended to use the HorizontalDistance constraint on horizontal lines and VerticalDistance on vertical lines instead of Length constraints.
It would be nice to have this at least as the default.
It would be nice to have this at least as the default.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: Feature request : round corner rectangle
@chrisb: I am editing the script trying to follow your suggestion
OS: Ubuntu 18.04.4 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.4.
Build type: Release
Python version: 3.6.8
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Austria (de_AT)
InI wonder if it is possible to center the figures around an arbitrary point, not just the origin. The workflow would be:
- if a point is selected, then the figure uses this point as center
I discovered a way to get the selected point in the sketch.
I have an open sketch with only one point selected. When I try in the python console the following error message occuresby chrisb » Wed Apr 11, 2018 6:55 am
use
to get the vertex instead of his name.Code: Select all
FreeCADGui.Selection.getSelectionEx()[0].SubObjects[0]
Code: Select all
>>> Gui.Selection.getSelectionEx()[0].SubElementNames[0]
'Vertex11'
>>> Gui.Selection.getSelectionEx()[0].SubObjects[0]
Traceback (most recent call last):
File "<input>", line 1, in <module>
IndexError: tuple index out of range
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.4.
Build type: Release
Python version: 3.6.8
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Austria (de_AT)
Re: Feature request : round corner rectangle
Sorry for the late reply.
I have tested in an open sketch
- select the origin
- select an end point of a line
- select a geometric element point
- select the center of a circle
- select the endpoint of an arc
no errors here. You may try with a current 0.19.
OS: macOS High Sierra (10.13)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.21938 (Git)
Build type: Release
Branch: master
Hash: 5666598a6be219830a992610243fe23144a61453
Python version: 3.8.2
Qt version: 5.12.5
Coin version: 4.0.0
OCC version: 7.4.0
Locale: C/Default (C)
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: Feature request : round corner rectangle
I think that bug is removed. Please test new version attached. While the macro is active you can switch between documents, and in a document between sketches.Furthermore I found that switching between models is not possible without restarting the model. I did the following:
- open two files with sketches in them
- open sketch in first model
- run the macro; it installs a third tab Centered Figures besides Model and Tasks
- create a figure with the macro; it will be correctly created in the sketch
- switch to the Tasks tab and close the sketch.
- Switch to the other model
- open the sketch in that model
- create a figure; this seems natural, as the additional tab still exists
- it seems as if nothing has happened; in fact another figure is added to the existing sketch in the first model.
My concept is to support loft and pipe commands: Before starting the script, the user should have (using another script) created many empty sketches perpendicular to a spine curve. Now my script is started. You switch between the empty sketches generating related sections in every sketch.
A desirable approach would be, to close the macro when swapping between documents. But I found no solution as yet.
Next I will attempt to provide the other suggestions.
- Attachments
-
- CenteredFiguresInSketcher.FCMacro
- (13.78 KiB) Downloaded 68 times
Re: Feature request : round corner rectangle
Thanks. The test may have to wait until the weekend.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.