Create and display local coordinate system

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
saso
Veteran
Posts: 1924
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Create and display local coordinate system

Post by saso »

Well my first argument for it would be that mostly all parametric cad systems have it, here is a quick search around the internet for some screenshots of nx, creo, inventor, solidworks, catia (see videos before),... I am sure other have it also.

Use cases... I guess more or less all use cases that airplanes are used for in Lattice; things seen in the few catia videos I have posted in this topic; Zolko's case for Part placement in assemblies; Pauvres_honteux also talked about this before https://forum.freecadweb.org/viewtopic. ... 79#p140379 (check also pdf's),...

<Edit>I guess it can be useful also for Path WB, to set different, user defined coordinate systems, for cnc machines...<End of edit>

I guess to understand csys compared to existing datum elements (point, planes, lines) one can think about the different degrees of freedom that each of them sets for the user, a point in space defines the three coordinates (x,y,z) but generally does not define the orientation; a plane defines the orientation and one coordinate (lets say z) the other two (x,y) are defined when something is placed on that plane; an csys defines everything... sort of :roll:
Attachments
solidworks.png
solidworks.png (18.47 KiB) Viewed 2522 times
inventor.png
inventor.png (19.64 KiB) Viewed 2522 times
creo.png
creo.png (28.73 KiB) Viewed 2522 times
nx.png
nx.png (12.44 KiB) Viewed 2522 times
Last edited by saso on Tue Aug 06, 2019 11:56 pm, edited 3 times in total.
Jee-Bee
Veteran
Posts: 2566
Joined: Tue Jun 16, 2015 10:32 am
Location: Netherlands

Re: Create and display local coordinate system

Post by Jee-Bee »

I would say for my self. i use coordinate system most to define placement on higher/ lower level.
I use it less often for modeling purposes.
but in any case why are creating datum planes and datum axis seen as an need but is a datum coordinate system not needed.
all datum features have it's own (personal) use case. off course some are used more often but i think all should be implemented.
saso wrote: Thu Dec 20, 2018 9:05 am What I would find even much much better is if all of them (point, line, plane, cs) would be changed so that they can be used generally (not just in Body),...
I agree on this. Maybe we should make an separate topic from this. that it don't get lost in this topic and it's more easy to find it back.
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: Create and display local coordinate system

Post by Zolko »

saso wrote: Thu Dec 20, 2018 9:05 am CoordinateSystem seems functional and usable to me, can it be added to the gui?
Did you find where to enable this in the sourcecode, or was that screenshot photoshopped ?
try the Assembly4 workbench for FreCAD — tutorials here and here
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Create and display local coordinate system

Post by DeepSOIC »

saso wrote: Thu Dec 20, 2018 11:50 am I guess more or less all use cases that airplanes are used for in Lattice; things seen in the few catia videos ...
... can be useful also for Path WB, to set different, user defined coordinate systems, for cnc machines..
Well, these are potential uses, not ones that we get working for free (well, except I made Lattice support them already). As a result, the request to include them into 0.18 that is probably to be released soon seems strange: we get a thing that doesn't do much, yet has a lot of potential... kinda disappointing.

But it can be done... after all, something can be much better than nothing. I'm for! Who's up to write the code?
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: Create and display local coordinate system

Post by Zolko »

DeepSOIC wrote: Thu Dec 20, 2018 9:14 pm But it can be done... after all, something can be much better than nothing. I'm for! Who's up to write the code?
In the file ~/src/Mod/PartDesign/Gui/Resources/PartDesign.qrc there is mention of <file>icons/PartDesign_CoordinateSystem.svg</file> , and indeed the icon file exists. Therefore I believe it's only a matter of enabling the button.

Then there is another subject about the LCS: it is visually defined in ~/src/Mod/PartDesign/Gui/ViewProviderDatumCS.cpp, in "void ViewProviderDatumCoordinateSystem::attach ( App::DocumentObject *obj )". It is not very satisfactory.

But a much nicer LCS implementation exists, it's called AxisCross, and can be (visually) enabled in the menu "View → Toggle axis Cross". That is defined in ~/src/Gui/View3DInventorViewer.cpp, in the function "void View3DInventorViewer::setAxisCross(bool on)"

If it were be possible to use the same visual for the LCS as for AxisCross, it would be awesome.
Attachments
LCS_AxisCross.png
LCS_AxisCross.png (190.84 KiB) Viewed 2407 times
try the Assembly4 workbench for FreCAD — tutorials here and here
User avatar
saso
Veteran
Posts: 1924
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Create and display local coordinate system

Post by saso »

Zolko wrote: Thu Dec 20, 2018 5:17 pm
saso wrote: Thu Dec 20, 2018 9:05 am CoordinateSystem seems functional and usable to me, can it be added to the gui?
Did you find where to enable this in the sourcecode, or was that screenshot photoshopped ?
It was Gimped ;) For testing and playing I am ok with the command line, so I will wait to hopefully see an official solution for the gui, but if you really want it you can add it as a macro.
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Create and display local coordinate system

Post by triplus »

Likely, as it was suggested back then, we should have introduced a coordinate system feature named Coordinate system. We named it Part feature instead, and have left the door for ambiguity wide open.
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: Create and display local coordinate system

Post by Zolko »

saso wrote: Thu Dec 20, 2018 9:05 am CoordinateSystem seems functional and usable to me, can it be added to the gui? Please :) At least as the other datum elements in the Part Design to be used in the Body
gotcha, succeeded at last:

Create_LCS.png
Create_LCS.png (344.07 KiB) Viewed 2230 times

And it's not GIMP'ed either (well, apart from the red circle). Unfortunately, I don't completely remember what did the thing, because I've been modifying loads of files. If someone wants to try, it's at least in the file ~/src/Mod/PartDesign/Gui/Command.cpp, and you have to duplicate the section about "Datum feature commands", and add before DEF_STD_CMD_A(CmdPartDesignPlane);

Code: Select all

DEF_STD_CMD_A(CmdPartDesignCS);

CmdPartDesignCS::CmdPartDesignCS()
  :Command("PartDesign_CoordinateSystem")
{
    sAppModule      = "PartDesign";
    sGroup          = QT_TR_NOOP("PartDesign");
    sMenuText       = QT_TR_NOOP("Create a local coordinate system");
    sToolTipText    = QT_TR_NOOP("Create a new local coordinate system");
    sWhatsThis      = "PartDesign_CoordinateSystem";
    sStatusTip      = sToolTipText;
    sPixmap         = "PartDesign_CoordinateSystem";
}

void CmdPartDesignCS::activated(int iMsg)
{
    Q_UNUSED(iMsg);
    UnifiedDatumCommand(*this, Base::Type::fromName("PartDesign::CoordinateSystem"),"LCS");
}

bool CmdPartDesignCS::isActive(void)
{
    if (getActiveGuiDocument())
        return true;
    else
        return false;
}
also, at the end, in CreatePartDesignCommands, add

Code: Select all

rcCmdMgr.addCommand(new CmdPartDesignCS());

and recompile.
try the Assembly4 workbench for FreCAD — tutorials here and here
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: Create and display local coordinate system

Post by Zolko »

Zolko wrote: Mon Jan 07, 2019 8:27 pm If someone wants to try, it's at least in the file ~/src/Mod/PartDesign/Gui/Command.cpp

... and you also have to add them to the menu and toolbar, in ~/src/Mod/PartDesign/Gui/Workbench.cpp, add in Gui::MenuItem* Workbench::setupMenuBar and in Gui::ToolBarItem* Workbench::setupToolBars

Code: Select all

Gui::MenuItem* Workbench::setupMenuBar() const
...
<< "PartDesign_Plane"
<< "PartDesign_CoordinateSystem"

Code: Select all

Gui::ToolBarItem* Workbench::setupToolBars() const
...
<< "PartDesign_Plane"
<< "PartDesign_CoordinateSystem"
try the Assembly4 workbench for FreCAD — tutorials here and here
freecad-heini-1
Veteran
Posts: 7790
Joined: Tue Jan 07, 2014 11:10 am
Contact:

Re: Create and display local coordinate system

Post by freecad-heini-1 »

Zolko wrote: Mon Jan 07, 2019 8:27 pm
saso wrote: Thu Dec 20, 2018 9:05 am CoordinateSystem seems functional and usable to me, can it be added to the gui? Please :) At least as the other datum elements in the Part Design to be used in the Body
gotcha, succeeded at last:


Create_LCS.png


And it's not GIMP'ed either (well, apart from the red circle). Unfortunately, I don't completely remember what did the thing, because I've been modifying loads of files. If someone wants to try, it's at least in the file ~/src/Mod/PartDesign/Gui/Command.cpp, and you have to duplicate the section about "Datum feature commands", and add before DEF_STD_CMD_A(CmdPartDesignPlane);

Code: Select all

DEF_STD_CMD_A(CmdPartDesignCS);

CmdPartDesignCS::CmdPartDesignCS()
  :Command("PartDesign_CoordinateSystem")
{
    sAppModule      = "PartDesign";
    sGroup          = QT_TR_NOOP("PartDesign");
    sMenuText       = QT_TR_NOOP("Create a local coordinate system");
    sToolTipText    = QT_TR_NOOP("Create a new local coordinate system");
    sWhatsThis      = "PartDesign_CoordinateSystem";
    sStatusTip      = sToolTipText;
    sPixmap         = "PartDesign_CoordinateSystem";
}

void CmdPartDesignCS::activated(int iMsg)
{
    Q_UNUSED(iMsg);
    UnifiedDatumCommand(*this, Base::Type::fromName("PartDesign::CoordinateSystem"),"LCS");
}

bool CmdPartDesignCS::isActive(void)
{
    if (getActiveGuiDocument())
        return true;
    else
        return false;
}
also, at the end, in CreatePartDesignCommands, add

Code: Select all

rcCmdMgr.addCommand(new CmdPartDesignCS());

and recompile.
Whow, after a while the axis cross is here. Very nice, Thank's to the developer.
Post Reply