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
mark1791
Posts: 28
Joined: Fri Aug 03, 2018 1:41 am

Re: Create and display local coordinate system

Post by mark1791 »

Hi All

Stumbled across this forum post about Axis systems, i am wondering is it possible to add in the ability to define the App:Placement a Vector for the Z Axis and even one for the X Axis would be nice?.

I did try to use .Normal vector or .Rotation but it didn't work. I can Create a Axis on the point i would like, but not able to create the axis in the direction i would like. The Reason is i would like to define to Press Tooling Direction of a Press part in Global Axis System(Carline) i create a point and direction vector manually for the direction i require and it would be nice to create a CAD Axis. My code as modified from earlier part of the thread.

The Two pictures are of a part which i have been given of the left hand of the Car, and the Right hand is symmetrical, i have defined the press centre and the direction of the press, am able to mirror the part, but would like to create a Axis that can be used to view to check undercuts etc.

Did look at the Part Design Axis, but creates a not so pretty axis. The App:Placement one looks more the part and scales with the view better IMHO.

FYI, The WB is something i have been working on to create 3D CAD geometry to generate 3D Lines/Planes/Points/Axis/Mirror Part Plane/Rotate Part Axis etc. for quick generation for setting up Press Parts in 3D and to help the surfacing of the Tool Surface. Hope to release soon to the FreeCAD world as soon as i got everything working, nearly there for alpha release.

Code: Select all

plm=App.ActiveDocument.addObject("App::Placement","CSW")
plm.Placement.Base=App.Vector(rot_p_x,rot_p_y,rot_p_z)
plm.Normal=(vector_line[0],vector_line[1],vector_line[2])
OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.15860 (Git)
Build type: Release
Branch: master
Hash: 3b708c7f84b0425076b520e1d95627b20fd75fe0
Python version: 2.7.14
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.2.0
Locale: English/UnitedKingdom (en_GB)


Before Creation of Axis
Press_Direction_Mirrored_Part.jpg
Press_Direction_Mirrored_Part.jpg (241.75 KiB) Viewed 1711 times
After Creation of Axis
Press_Direction_Mirrored_Part_APM_Placement.jpg
Press_Direction_Mirrored_Part_APM_Placement.jpg (243.69 KiB) Viewed 1711 times
User avatar
Pauvres_honteux
Posts: 728
Joined: Sun Feb 16, 2014 12:05 am
Location: Far side of the moon

Re: Create and display local coordinate system

Post by Pauvres_honteux »

mark1791 wrote: Mon Feb 18, 2019 6:09 am
It seems you are working on "surfaces originating from points and wires"?
Specifically for sheet metal or surfaces in general?
User avatar
mark1791
Posts: 28
Joined: Fri Aug 03, 2018 1:41 am

Re: Create and display local coordinate system

Post by mark1791 »

Pauvres_honteux wrote: Mon Feb 18, 2019 6:24 am
mark1791 wrote: Mon Feb 18, 2019 6:09 am
It seems you are working on "surfaces originating from points and wires"?
Specifically for sheet metal or surfaces in general?
Thats the plan, create some tools to generate surfaces for the main tool surface as quickly as possible, my day job is to do this in CATIA V5 and then provide simulation of the surface for feasibility of the parts and process. There isn't much in FreeCAD workbenches that has focus on basic 3D points/lines/arc's/planes creation quickly, its there in python but most users don't want to get too dirty with code.

The workbench is based around tipping parts in 3D, mirroring the part if symmetrical and can be run double in the Press, axis and press direction are always import for stamping of parts.
User avatar
Pauvres_honteux
Posts: 728
Joined: Sun Feb 16, 2014 12:05 am
Location: Far side of the moon

Re: Create and display local coordinate system

Post by Pauvres_honteux »

This is so exiting!
Since you use catia you are possibly used to the command "point on extrema"? That principle would be highly sought after in the long run, if possible.

Perhaps you've seen the discussion of
Translate a point with a vector direction.
I think this would be a nice addition to your workbench if there's time.

I'm really seeing forward to this essensial workbench.
User avatar
mark1791
Posts: 28
Joined: Fri Aug 03, 2018 1:41 am

Re: Create and display local coordinate system

Post by mark1791 »

Pauvres_honteux wrote: Tue Feb 19, 2019 6:00 am This is so exiting!
Since you use catia you are possibly used to the command "point on extrema"? That principle would be highly sought after in the long run, if possible.

Perhaps you've seen the discussion of
Translate a point with a vector direction.
I think this would be a nice addition to your workbench if there's time.

I'm really seeing forward to this essensial workbench.
i have created the ability to translate a point a direction vector of any length, ironically in nearly 20 years of V5 not used "point on extrema" http://catiadoc.free.fr/online/cfyug_C2 ... umelem.htm.

The WB will let you translate/create a point along a line vector any distance, see gif below, unfortunately the point is not linked to the line and the distance cannot be changed after creation but, if you need a new point just create a new one, ideally more parametrization for the future would be nice, but for me creating tooling surfaces too much can be bad if updating the surface if there is too much change.
Point_Line.gif
Point_Line.gif (518.85 KiB) Viewed 1639 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 »

mark1791 wrote: Mon Feb 18, 2019 6:09 am Stumbled across this forum post about Axis systems, i am wondering is it possible to add in the ability to define the App:Placement a Vector for the Z Axis and even one for the X Axis would be nice?.

Code: Select all

plm=App.ActiveDocument.addObject("App::Placement","CSW")
You're confounding App::Placement objects with App.Placement properties. In this case, it quacks like a duck and walks like a duck, but it's not a duck. Most geometries have an App.Placement property, CoordinateSystems do have them and so do App::Placement objects. Yes, it's strange, but that's life. App::Placements look like PartDesign::CoordinateSystems, they both do have App.Placement properties, but they don't have the same usage at all.

Try:

Code: Select all

lcs = App.activeDocument().addObject( 'PartDesign::CoordinateSystem', 'LCS' )
And then, in the Properties, look in the Attachment section, MapMode: click on the tiny button that the developers don't want you to see (it's hidden until you click in the field and then hoover over with the mouse, I don't know why, it's completely stupid) and there you can choose many options to attach and orient the coordinate system. You can then create a Datum Point, attach it to the previously created LCS with its MapMode, and specify an offset along one direction to get what you want (if I understood correctly)

It's very nice and powerful, but hidden from sight for no reason that I can understand.
try the Assembly4 workbench for FreCAD — tutorials here and here
Post Reply