Create and display local coordinate system

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
User avatar
Zolko
Posts: 400
Joined: Mon Dec 17, 2018 10:02 am

Re: Create and display local coordinate system

Postby Zolko » Tue Dec 18, 2018 7:43 pm

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 v0.19
install with Tools > Addon Manager > Assembly4 — simple tutorial here
User avatar
saso
Posts: 1332
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Create and display local coordinate system

Postby saso » Tue Dec 18, 2018 8:25 pm

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
Posts: 7051
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: Create and display local coordinate system

Postby DeepSOIC » Tue Dec 18, 2018 8:42 pm

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
Posts: 1332
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Create and display local coordinate system

Postby saso » Tue Dec 18, 2018 9:05 pm

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 832 times
Last edited by saso on Tue Dec 18, 2018 10:33 pm, edited 1 time in total.
User avatar
Zolko
Posts: 400
Joined: Mon Dec 17, 2018 10:02 am

Re: Create and display local coordinate system

Postby Zolko » Tue Dec 18, 2018 9:25 pm

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 v0.19
install with Tools > Addon Manager > Assembly4 — simple tutorial here
User avatar
saso
Posts: 1332
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Create and display local coordinate system

Postby saso » Tue Dec 18, 2018 10:15 pm

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

cs transform.FCStd
(16.87 KiB) Downloaded 25 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 812 times
Last edited by saso on Wed Dec 19, 2018 11:40 am, edited 3 times in total.
User avatar
Zolko
Posts: 400
Joined: Mon Dec 17, 2018 10:02 am

Re: Create and display local coordinate system

Postby Zolko » Wed Dec 19, 2018 8:45 am

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 v0.19
install with Tools > Addon Manager > Assembly4 — simple tutorial here
User avatar
saso
Posts: 1332
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Create and display local coordinate system

Postby saso » 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... 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 649 times
User avatar
Zolko
Posts: 400
Joined: Mon Dec 17, 2018 10:02 am

Re: Create and display local coordinate system

Postby Zolko » Thu Dec 20, 2018 9:52 am

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 v0.19
install with Tools > Addon Manager > Assembly4 — simple tutorial here
User avatar
DeepSOIC
Posts: 7051
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: Create and display local coordinate system

Postby DeepSOIC » Thu Dec 20, 2018 10:52 am

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.