What is the meaning of "Placement" in path operations?

Here's the place for discussion related to CAM/CNC and the development of the Path module.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
nahshon
Posts: 225
Joined: Wed Jul 24, 2013 8:06 pm

What is the meaning of "Placement" in path operations?

Post by nahshon »

I'm confused. Should a path element have a "Placement" and how is it used?

I see that a Job really creates paths twice. It looks like each operation creates own path, which is affected by the placement. The "Job" creates a combined path that is not affected by placements.
(Is this duplication needed?)

If we look at PathJob.py, function execute:

Code: Select all

                if obj.UsePlacements:
                    for c in child.Path.Commands:
                        cmds.append(c.transform(child.Placement))
                else:
                    cmds.extend(child.Path.Commands)
but I could not find where obj.UsePlacements could be modified.
There is similar code in PathCompoundExtended.py.
FeaturePathCompound.cpp actually has a property for UsePlacements.
Untitled.png
Untitled.png (144.45 KiB) Viewed 3372 times
nahshon
Posts: 225
Joined: Wed Jul 24, 2013 8:06 pm

Re: What is the meaning of "Placement" in path operations?

Post by nahshon »

Also, the Position of the Body is ignored. IMHO this is a bug as there is no way to create a path that is related to a rotated shape. I will open a bug in the tracker after I understand what is the correct behavior.
Untitled1.png
Untitled1.png (75.59 KiB) Viewed 3361 times
Attachments
Shape2.fcstd
(18.66 KiB) Downloaded 54 times
User avatar
sliptonic
Veteran
Posts: 3457
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: What is the meaning of "Placement" in path operations?

Post by sliptonic »

A quick overview of the Path objects:
In C++ we have:
Command: which holds a single command with its parameters
Path: holds a list of commands.
(Also tools and tooltables but that's not relevant here.)

The user is interacting with the Python Feature objects which are:
Path Feature: A document object that holds a Path and takes care of drawing it.
Path Compound: Works like a FreeCAD group and collects several Paths together.
Path Job (formerly called Path Project): A special case of Compound. Jobs are generally what you want to post-process.

The job doesn't really create the path twice but it does display it twice, once for the underlying Path and once for the group itself.

Path Placements *should* apply a transform to the path and result in shifted gcode. However, I believe this is pretty thoroughly broken at the moment.
The UsePlacement transformation was in place before v0.17 started and hasn't received any attention since. So I'm not even clear how this should work related to SuperPlacements, Bodies, Parts, etc.
nahshon
Posts: 225
Joined: Wed Jul 24, 2013 8:06 pm

Re: What is the meaning of "Placement" in path operations?

Post by nahshon »

sliptonic wrote:A quick overview of the Path objects:
Thanks for the review. I find it really helpful.
The job doesn't really create the path twice but it does display it twice, once for the underlying Path and once for the group itself.
If I understand it, a path is actually stored twice (in memory and in the .fcstd file). Ideally it should be kept only once in memory. Is there a reason to store a path that can be recomputed in the .fcstd file?

I think I can now explain a feature that I would like to see in FreeCAD.
Add an optional "Placement" operation that will take effect before a series of milling/drilling operations.
The meaning of the operation is that a part should be mounted in a certain placement/orientation before the following operation are processed.
The resulting path will be viewed with the reverse transformation (so it is still aligned with the body view).

If the machine has 4 or 5 axes, the "Placement" command could actually rotate the part to the requested orientation. Otherwise it may be possible to pause the CNC operation and let the user mount the part to the new position.

The (faked) image is an attempt to show a possible result of processing 6 faces, where each face has a different placement.
Untitled2.png
Untitled2.png (25.42 KiB) Viewed 3336 times
mlampert
Veteran
Posts: 1772
Joined: Fri Sep 16, 2016 9:28 pm

Re: What is the meaning of "Placement" in path operations?

Post by mlampert »

nahshon wrote:I think I can now explain a feature that I would like to see in FreeCAD.
Add an optional "Placement" operation that will take effect before a series of milling/drilling operations.
The meaning of the operation is that a part should be mounted in a certain placement/orientation before the following operation are processed.
The resulting path will be viewed with the reverse transformation (so it is still aligned with the body view).
Would the same be achieved if you could place and orient the part itself before you create the Job and it's Paths?

In a similar vain, let's say, you had the possibility to move and rotate the Part - and you could place the origin (0,0,0) anywhere you want. Would you still require a placement of an individual Path?
nahshon
Posts: 225
Joined: Wed Jul 24, 2013 8:06 pm

Re: What is the meaning of "Placement" in path operations?

Post by nahshon »

mlampert wrote:
nahshon wrote:I think I can now explain a feature that I would like to see in FreeCAD.
Add an optional "Placement" operation that will take effect before a series of milling/drilling operations.
The meaning of the operation is that a part should be mounted in a certain placement/orientation before the following operation are processed.
The resulting path will be viewed with the reverse transformation (so it is still aligned with the body view).
Would the same be achieved if you could place and orient the part itself before you create the Job and it's Paths?

In a similar vain, let's say, you had the possibility to move and rotate the Part - and you could place the origin (0,0,0) anywhere you want. Would you still require a placement of an individual Path?
It will not work now, due to a bug.

Anyway, a part can normally use multiple placements. One may be used for assembly, one or more for manufacturing, and then you may want to use a placement for packaging (which could be described as yet another assembly).
Also, remember that a part may have multiple copies in an assembly, each copy with own placement.

My idea here is to include the placement used for manufacturing as part of the job (or a compound). A simple job for a single part will use just one placement t the beginning of the job. Complex jobs may contain more than one placement, and in the future I hope this could be used for controlling rotation in multi-axis machines.
mlampert
Veteran
Posts: 1772
Joined: Fri Sep 16, 2016 9:28 pm

Re: What is the meaning of "Placement" in path operations?

Post by mlampert »

Got that, thanks for the clarification.
If that bug was fixed and you had the ability to place a part specifically for a job - would there still be a requirement for a placement of an individual Path (also assuming that bug was fixed and it would work)?
nahshon
Posts: 225
Joined: Wed Jul 24, 2013 8:06 pm

Re: What is the meaning of "Placement" in path operations?

Post by nahshon »

mlampert wrote:Got that, thanks for the clarification.
If that bug was fixed and you had the ability to place a part specifically for a job - would there still be a requirement for a placement of an individual Path (also assuming that bug was fixed and it would work)?
Assuming the bug would be fixed, it will be possible to position a part, create a job and create the gcode file, then change back to the original position of the part.

By having a placement command in the job, it will be separate from the default placement of the part, and also it will be possible to create gcode for multiple placements of the same part.
roivai
Posts: 117
Joined: Thu Feb 02, 2017 5:29 pm
Location: Oulu, Finland

Re: What is the meaning of "Placement" in path operations?

Post by roivai »

Hi,

I struggled with this same question as I needed to make a Path job that would cut multiple parts on a same run. I know it could be done with fixture offset etc, but I also wanted to rotate parts to allow efficient nesting on the stock. I thought it would be easily done by making a copy of a (compound) Path and then placing it with offset and rotation. But like mentioned here, the Placement only affected the view object, not the Path itself.

I wrote a method to position and rotate Path commands if anyone is interested. For now, I incorporated it to PathCopy feature only, as that was what I needed at that point. But if needed, I think it could be used more generally. It allowed me to do for example this:
pathcopy_example.png
pathcopy_example.png (55.43 KiB) Viewed 2852 times
You can check the code by looking at a commit on my fork:

https://github.com/pekkaroi/FreeCAD/com ... 49da50bc3b

BR,
Pekka
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: What is the meaning of "Placement" in path operations?

Post by yorik »

The general idea behind having a placement in Path objects was:

- You can have a Path that is expressed in machine coordinates (basically in the XY plane), but that you could move around in FreeCAD (for example place it on top of the assembled object). Moving the path around should reflect in its display in FreeCAD, but should not change the gcode coordinates, because you will still want to cut the piece in the XY plane.

- Sometimes, however, you do want that moving the placement affects its stored coordinates. For example, you would want to simply copy/paste a same path object at several locations. For that, it must be encapsulated inside a Path Compound. The Path Compound has a property to turn on/off the use of its childrens placements. If on, the compound, when building its final path, will apply the placement of its children.
Post Reply