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
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: Create and display local coordinate system

Post by Zolko »

DeepSOIC wrote: Mon Dec 17, 2018 11:13 pm BTW, try:

Code: Select all

App.ActiveDocument.addObject('App::Placement')
It's a CS frame. But it's not useful, because nothing supports it.
Holy cow, the LCS feature already exists !!!

Code: Select all

App.activeDocument().Body.newObject('PartDesign::CoordinateSystem','LCS')
And it looks like an LCS (no arrowheads though, visually it's defined in ~/src/Mod/PartDesign/Gui/ViewProviderDatumCS.cpp), it's selectable, it highlights in the 3D window ... don't know whether it's used though. And I don't know why the creation of datum coordinate systems has not a corresponding button, although there is an icon for it : "PartDesign_CoordinateSystem.svg"
try the Assembly4 workbench for FreCAD — tutorials here and here
User avatar
saso
Veteran
Posts: 1920
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Create and display local coordinate system

Post by saso »

And one can actually place datum elements outside the body! :)

Code: Select all

App.ActiveDocument.addObject('PartDesign::Plane')
App.ActiveDocument.addObject('PartDesign::Point')
App.ActiveDocument.addObject('PartDesign::CoordinateSystem')
Now if only things would not be jumping out of the Part all the time... :roll:
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 »

Zolko wrote: Tue Dec 18, 2018 7:43 pm And it looks like an LCS (no arrowheads though, visually it's defined in ~/src/Mod/PartDesign/Gui/ViewProviderDatumCS.cpp), it's selectable, it highlights in the 3D window ... don't know whether it's used though.
Nice catch. I wanted to show that one too, but couldn't find it.

It was used for attaching PartDesign primitives back in the early days of 0.17dev. Then, ickby invented Extension mechanism for creating chunks of re-usable functionality, and PD Primitives now use extension-powered attachment directly, and don't need the CS object.
Otherwise, I don't know if this PartDesign::CoordinateSystem is supported by anything.
User avatar
saso
Veteran
Posts: 1920
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Create and display local coordinate system

Post by saso »

Soooo close to heaven... Elements from Part WB (Sketch, Extrude) and elements from PartDesign WB (Body, Sketch001, Pad) all driven by the same datum plane (PartDesign__Plane) :)
Attachments
fc.jpg
fc.jpg (51.14 KiB) Viewed 3923 times
Last edited by saso on Tue Dec 18, 2018 10:33 pm, edited 1 time in total.
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: Tue Dec 18, 2018 8:42 pm Otherwise, I don't know if this PartDesign::CoordinateSystem is supported by anything.
well well well, its time could come : there is my pet problem of making assemblies without constraints, where parts are placed by snapping their respective LCS. Ne messing with parallelisms, concentricities, tangencies.... pure rigid attachment. An LCS might not be the origin (0,0,0), and a part (body) might have several potential attachment points, thus several LCS. Think about a wheel, that could be attached on its axis on either side: needs 2 LCS, and the attachment LCS is selected during assembly.

see @ forum: https://forum.freecadweb.org/viewtopic.php?f=20&t=32843
try the Assembly4 workbench for FreCAD — tutorials here and here
User avatar
saso
Veteran
Posts: 1920
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Create and display local coordinate system

Post by saso »

Also axis to axis transform, no problem :)
https://www.youtube.com/watch?v=7-p5lHGIl8A

cs transform.FCStd
(16.87 KiB) Downloaded 98 times

In the animation below I am selecting the datum plane and changing its map mode, but it is possible to do much much more...

GIF.gif
GIF.gif (63.22 KiB) Viewed 3903 times
Last edited by saso on Wed Dec 19, 2018 11:40 am, edited 3 times in total.
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: Create and display local coordinate system

Post by Zolko »

Code: Select all

App.activeDocument().Body.newObject('PartDesign::CoordinateSystem','LCS')
saso wrote: Tue Dec 18, 2018 8:25 pm

Code: Select all

App.ActiveDocument.addObject('PartDesign::CoordinateSystem')
you're right, that's better, it doesn't need any Body object. It doesn't need any Part object either ... actually, you can add this to any active document. Even better if you name it:

Code: Select all

App.ActiveDocument.addObject('PartDesign::CoordinateSystem','LCS_1')
try the Assembly4 workbench for FreCAD — tutorials here and here
User avatar
saso
Veteran
Posts: 1920
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Create and display local coordinate system

Post by saso »

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... BUT! 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), as demonstrated above, and the icons moved from the Part Design Helper toolbar, next to the Part and Group icons in the Structure toolbar :)
Attachments
Untitled.png
Untitled.png (63.98 KiB) Viewed 3740 times
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
I agree, and this should be done for the 0.18 release
. BUT! 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), as demonstrated above, and the icons moved from the Part Design Helper toolbar, next to the Part and Group icons in the Structure toolbar :)
This can wait for after 0.18 I think
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 9:05 am CoordinateSystem seems functional and usable to me, can it be added to the gui? Please
BTW, can you list a few actual uses for it?
EDIT: 1. the project above, where stuff is attached to the LCS.

If we are going for it, we at least should provide some compatibility, I think.
Post Reply