PathCopy, PathArray, PathCompound broken

Here's the place for discussion related to CAM/CNC and the development of the Path module.
roivai
Posts: 117
Joined: Thu Feb 02, 2017 5:29 pm
Location: Oulu, Finland

PathCopy, PathArray, PathCompound broken

Postby roivai » Thu Jun 01, 2017 8:14 pm

PathArray, PathCopy and PathCompound seem to be broken as they don't have the ToolController property which is expected by PathPost. I badly needed to create an array so I fixed those in this branch: https://github.com/pekkaroi/FreeCAD/tree/PathArrayTC

I fixed it by introducing the ToolController property to them and copied the value of the property from the child when created or executed. I think this is not very elegant, as the "container" operation does not really need a TC as the actual path is generated respecting the child's TC. But I don't know how the PathPost should be modified to handle that situation.

Is this worth creating a PR to make those tools work for now?

PathSimpleCopy fails for some reason probably not related to TCs. That I did not investigate further.
User avatar
sliptonic
Posts: 1573
Joined: Tue Oct 25, 2011 10:46 pm

Re: PathCopy, PathArray, PathCompound broken

Postby sliptonic » Thu Jun 01, 2017 10:02 pm

roivai wrote:
Thu Jun 01, 2017 8:14 pm
PathArray, PathCopy and PathCompound seem to be broken as they don't have the ToolController property which is expected by PathPost. I badly needed to create an array so I fixed those in this branch: https://github.com/pekkaroi/FreeCAD/tree/PathArrayTC

I fixed it by introducing the ToolController property to them and copied the value of the property from the child when created or executed. I think this is not very elegant, as the "container" operation does not really need a TC as the actual path is generated respecting the child's TC. But I don't know how the PathPost should be modified to handle that situation.

Is this worth creating a PR to make those tools work for now?

PathSimpleCopy fails for some reason probably not related to TCs. That I did not investigate further.
I've neglected these tools for a while so I'm not surprised they're broken. I actually had a need for a the PathArray recently but was disappointed that I couldn't do a two dimensional or polar variant like the draft array. I started thinking about re-working them and decided I didn't understand enough. For example, when should a user create a Path Array and when should he create a single Path from an array of parts?

So I'm asking for use-cases and expert input? What would you like these tools to do that can't be achieved using other FreeeCAD tools?
herbk
Posts: 1570
Joined: Mon Nov 03, 2014 3:45 pm
Location: Windsbach, Bavarya (Germany)

Re: PathCopy, PathArray, PathCompound broken

Postby herbk » Fri Jun 02, 2017 6:37 am

Hi sliptonic,

i used patharray several times and i like it...
Sometimes i need to mill out a lot of same parts. I create only one part, a path from it and make a array from this path. This workflow is much more quick and needs much less recourses as make copys from the part and create pathes from all of them.

A secound example is: Makeing a new top of my vakuumtable, where i have to drill about 2 times 2.000 holes... ;)

Both are usual things for working with a router, so i would miss it when patharray will be removed... :(
Last edited by herbk on Fri Jun 02, 2017 4:02 pm, edited 1 time in total.
Gruß Herbert
roivai
Posts: 117
Joined: Thu Feb 02, 2017 5:29 pm
Location: Oulu, Finland

Re: PathCopy, PathArray, PathCompound broken

Postby roivai » Fri Jun 02, 2017 1:22 pm

sliptonic wrote:
Thu Jun 01, 2017 10:02 pm
So I'm asking for use-cases and expert input? What would you like these tools to do that can't be achieved using other FreeeCAD tools?
Some non-expert input:
I think at least the PathArray is useful. And having possibilty to create 2D array or polar array would be great! I think that for cutting multiple pieces of the same part is more useful to do by array, because that way you don't have to create a separate document with multiple instances of the Part. With array, you can create the PathArray and use the same document as a part of an assembly (at least with Assembly2 I do that)

Compound is also somewhat useful for creating those arrays, you can compound multiple parts and then create the array. Also at the moment the compound is (AFAIK) the only way to move/rotate the Path without moving the part.

Those copy functionalities could be useful if you could move and rotate the copied Path. At the moment it is not possible except by creating compound of the copy. For example often you would like to create two similar paths except other would be rotated 180 deg for optimal nesting.

So, all in all, I would like to see all of them. I don't know about having both simple copy and linked copy. I don't quite know when I would use that simple copy.
mlampert
Posts: 1366
Joined: Fri Sep 16, 2016 9:28 pm

Re: PathCopy, PathArray, PathCompound broken

Postby mlampert » Fri Jun 02, 2017 2:50 pm

It seems ppl still use PathArray, so maybe we keep that for now until we find something better. I question the value of keeping the other ones around - given that they've been broken for quite some time and nobody seems to have noticed, or cared enough to point it out....

my 2C
User avatar
sliptonic
Posts: 1573
Joined: Tue Oct 25, 2011 10:46 pm

Re: PathCopy, PathArray, PathCompound broken

Postby sliptonic » Fri Jun 02, 2017 3:54 pm

Ok.
I've used (or tried to use) Array from time to time. @roivai, do you want to take a stab at expanding it to have two-dimensional and polar variants?

I also use non-parametric copy from time to time.

I've never used linked copy or Compound. I'm o.k. with keeping or losing them.
roivai
Posts: 117
Joined: Thu Feb 02, 2017 5:29 pm
Location: Oulu, Finland

Re: PathCopy, PathArray, PathCompound broken

Postby roivai » Fri Jun 02, 2017 7:07 pm

sliptonic wrote:
Fri Jun 02, 2017 3:54 pm
@roivai, do you want to take a stab at expanding it to have two-dimensional and polar variants?
I'll try. What crossed my mind is that how about making it more like a dressup? The current implementation adds a completely separate object, but would it be cleaner if the Array operation would enclose the original Path inside itself. Thoughts?
roivai
Posts: 117
Joined: Thu Feb 02, 2017 5:29 pm
Location: Oulu, Finland

Re: PathCopy, PathArray, PathCompound broken

Postby roivai » Sat Jun 03, 2017 8:22 pm

Two nights and three beers later I have something done.

Linear 2D pattern was rather simple. It now has CopiesX and CopiesY and the distance between copies is determined by the Offset parameter.
2017-06-03-225620_3840x1200_scrot.png
2017-06-03-225620_3840x1200_scrot.png (89.79 KiB) Viewed 790 times
Polar pattern is also implemented. It was trickier as the Command.translate function did not support rotation, so I wrote the function to rotate G-code myself. It may have some more general use? The Polar pattern asks for total angle, number of copies and the center location around which the rotation is done.
2017-06-03-225808_3840x1200_scrot.png
2017-06-03-225808_3840x1200_scrot.png (117.66 KiB) Viewed 790 times


With its current implementation, the Array object is created in parallel with the base object in the document tree. This means that when the Job is processed, both the original path and the array path are generated. This again means that the array path cannot include the original path, but only the new ones to avoid duplicates. This required bit more complex solution for the 2D array, as the first row of the array is different from others in the array path. A cleaner solution would be that the array would take the base path as its child like dressups do, for example. I discussed with @sliptonic and we concluded that there should be no reason not to do that, I just haven't implemented it at least yet.

Ideas how to make it even better? The Properties panel could look cleaner as there are now parameters for both linear and polar and it may look confusing. But that is how it is done in Draft Array as well.
User avatar
sliptonic
Posts: 1573
Joined: Tue Oct 25, 2011 10:46 pm

Re: PathCopy, PathArray, PathCompound broken

Postby sliptonic » Sun Jun 04, 2017 12:43 am

Looks great!

After we chatted on IRC, I tried out conditionally enabling properties again and it seems to be working fine. If you want to do that, the script in the thread you referred to works perfectly. Assuming this doesn't have a task panel, that's all there is to it. If you build a panel, you'll have to conditionally enable the controls there too.
herbk
Posts: 1570
Joined: Mon Nov 03, 2014 3:45 pm
Location: Windsbach, Bavarya (Germany)

Re: PathCopy, PathArray, PathCompound broken

Postby herbk » Sun Jun 04, 2017 9:57 am

Hi roywai,

looks verry good, only one suggestion to the 2D Array: Is it possible to reduce the "no work pathes"?
In your example the tool goes back to the left side after compleating one line (works each line from left to right). If the secound line works from right to left, you will save the time for going back to left.
Gruß Herbert