[Feature request] Rounded slot
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
[Feature request] Rounded slot
Hey guys,
I'm back using FreeCAD these days, which gives me plenty of ideas to share!
One feature that would be great is the rounded slot which is painful to make manually. To do something like this : This tool usually works by selecting the center of the circle along which the slot will run.
Then select the first point of the slot
Then second point of the slot
Then select the radius of the slot.
I'm back using FreeCAD these days, which gives me plenty of ideas to share!
One feature that would be great is the rounded slot which is painful to make manually. To do something like this : This tool usually works by selecting the center of the circle along which the slot will run.
Then select the first point of the slot
Then second point of the slot
Then select the radius of the slot.
Support me on Patreon: https://www.patreon.com/FreeCadDevDiary
FreeCad Dev Diary channel:[/b] https://www.youtube.com/channel/UCGMTmJ ... NiPSSEhBHA
FreeCad Dev Diary channel:[/b] https://www.youtube.com/channel/UCGMTmJ ... NiPSSEhBHA
Re: [Feature request] Rounded slot
Please search the forum, this was already discussed before.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: [Feature request] Rounded slot
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
Re: [Feature request] Rounded slot
The development of advanced slot features is done.
Three tools are added, all under the regular 'Slot' tool to avoid any bloat of the UI. 1 - Slot by 3 points is similar to the regular slot but you have a fourth click to set the radius. Instead of having an automatic radius.
2 - Arc slot is a slot around the arc of a circle.
3 - Rectangle slot is similar to arc slot but with line ends instead of arc ends.
- All tools works with preview of the curves (sketchgui->drawEdit).
- I reused the same code structure as the slot tool. Though arc slot and rectangle slot have individual classes due to the fact that the code was very different, making reusing the same class hard.
- Snap mode is not implemented because I wasn't sure how it could help. Maybe by fixing the angles to round values? Maybe in the future.
- There is only one bug. The icons of the comp don't change of color when in construction mode. The icons have been created, but it doesn't change as it should by the comp onactivated function. Strangely each individual tool has an onactivated function that I can't seem to be able to delete without build error. For other comp like polygons, only the comp as an onactivate function not the individual tools. I feel I'm missing something here.
Also if you can review those new tools and the chamfers tools when you have a chance?
The branch to which I pushed those tools : https://github.com/PaddleStroke/FreeCAD ... CurvedSlot
Three tools are added, all under the regular 'Slot' tool to avoid any bloat of the UI. 1 - Slot by 3 points is similar to the regular slot but you have a fourth click to set the radius. Instead of having an automatic radius.
2 - Arc slot is a slot around the arc of a circle.
3 - Rectangle slot is similar to arc slot but with line ends instead of arc ends.
- All tools works with preview of the curves (sketchgui->drawEdit).
- I reused the same code structure as the slot tool. Though arc slot and rectangle slot have individual classes due to the fact that the code was very different, making reusing the same class hard.
- Snap mode is not implemented because I wasn't sure how it could help. Maybe by fixing the angles to round values? Maybe in the future.
- There is only one bug. The icons of the comp don't change of color when in construction mode. The icons have been created, but it doesn't change as it should by the comp onactivated function. Strangely each individual tool has an onactivated function that I can't seem to be able to delete without build error. For other comp like polygons, only the comp as an onactivate function not the individual tools. I feel I'm missing something here.
Any idea regarding the icon bug?abdullah wrote: ping
Also if you can review those new tools and the chamfers tools when you have a chance?
The branch to which I pushed those tools : https://github.com/PaddleStroke/FreeCAD ... CurvedSlot
Support me on Patreon: https://www.patreon.com/FreeCadDevDiary
FreeCad Dev Diary channel:[/b] https://www.youtube.com/channel/UCGMTmJ ... NiPSSEhBHA
FreeCad Dev Diary channel:[/b] https://www.youtube.com/channel/UCGMTmJ ... NiPSSEhBHA
Re: [Feature request] Rounded slot
Have a look to: DEF_STD_CMD_A and DEF_STD_CMD_AU in src/Gui/Command.h.
You are looking for a macro that has the virtual function updateAction(int mode). This function gets called when the user changes from the construction to the normal mode a vice versa.
This mechanism is generic for any command having modes throughout FreeCAD. The enum defining the construction modes is in GeometryCreationMode.h.
This is used like in:
Code: Select all
void CmdSketcherCarbonCopy::updateAction(int mode)
{
switch (mode) {
case Normal:
if (getAction())
getAction()->setIcon(Gui::BitmapFactory().iconFromTheme("Sketcher_CarbonCopy"));
break;
case Construction:
if (getAction())
getAction()->setIcon(Gui::BitmapFactory().iconFromTheme("Sketcher_CarbonCopy_Constr"));
break;
}
}
Re: [Feature request] Rounded slot
Thanks for efforts, this will be a nice addition to Sketcher core.paddle wrote: ↑Sat Dec 18, 2021 7:44 pm The development of advanced slot features is done.
The branch to which I pushed those tools : https://github.com/PaddleStroke/FreeCAD ... CurvedSlot
Re: [Feature request] Rounded slot
Ok so this explained why I couldn't delete the individual updateaction functions.
I used DEF_STD_CMD_AU instead of DEF_STD_CMD_A for the individual tool.
But it still doesn't work. I can't find any difference with my comp compared to regularpolygon comp. My updateaction function seems correct :
Code: Select all
void CmdSketcherCompCreateSlot::updateAction(int mode)
{
Gui::ActionGroup* pcAction = qobject_cast<Gui::ActionGroup*>(getAction());
if (!pcAction)
return;
QList<QAction*> a = pcAction->actions();
int index = pcAction->property("defaultAction").toInt();
switch (mode) {
case Normal:
a[0]->setIcon(Gui::BitmapFactory().iconFromTheme("Sketcher_CreateSlot"));
a[1]->setIcon(Gui::BitmapFactory().iconFromTheme("Sketcher_CreateThreePointsSlot"));
a[2]->setIcon(Gui::BitmapFactory().iconFromTheme("Sketcher_CreateArcSlot"));
a[3]->setIcon(Gui::BitmapFactory().iconFromTheme("Sketcher_CreateRectangleSlot"));
getAction()->setIcon(a[index]->icon());
break;
case Construction:
a[0]->setIcon(Gui::BitmapFactory().iconFromTheme("Sketcher_CreateSlot_Constr"));
a[1]->setIcon(Gui::BitmapFactory().iconFromTheme("Sketcher_CreateThreePointsSlot_Constr"));
a[2]->setIcon(Gui::BitmapFactory().iconFromTheme("Sketcher_CreateArcSlot_Constr"));
a[3]->setIcon(Gui::BitmapFactory().iconFromTheme("Sketcher_CreateRectangleSlot_Constr"));
getAction()->setIcon(a[index]->icon());
break;
}
}
Support me on Patreon: https://www.patreon.com/FreeCadDevDiary
FreeCad Dev Diary channel:[/b] https://www.youtube.com/channel/UCGMTmJ ... NiPSSEhBHA
FreeCad Dev Diary channel:[/b] https://www.youtube.com/channel/UCGMTmJ ... NiPSSEhBHA
Re: [Feature request] Rounded slot
I rebuilt the project and it's now working !
So the function is completely working and waiting for approval!
So the function is completely working and waiting for approval!
Support me on Patreon: https://www.patreon.com/FreeCadDevDiary
FreeCad Dev Diary channel:[/b] https://www.youtube.com/channel/UCGMTmJ ... NiPSSEhBHA
FreeCad Dev Diary channel:[/b] https://www.youtube.com/channel/UCGMTmJ ... NiPSSEhBHA
Re: [Feature request] Rounded slot
Does the new functionality also have some unittests for automatic testing to catch regressions etc... ?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Re: [Feature request] Rounded slot
Sorry but I don't know what those are.
Can you please point to where I should start to have a look if that's a necessary component?
Thanks
Can you please point to where I should start to have a look if that's a necessary component?
Thanks
Support me on Patreon: https://www.patreon.com/FreeCadDevDiary
FreeCad Dev Diary channel:[/b] https://www.youtube.com/channel/UCGMTmJ ... NiPSSEhBHA
FreeCad Dev Diary channel:[/b] https://www.youtube.com/channel/UCGMTmJ ... NiPSSEhBHA