[Solved] Draft/PathArray--Expected Behavior?

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
User avatar
ppemawm
Veteran
Posts: 1240
Joined: Fri May 17, 2013 3:54 pm
Location: New York NY USA

[Solved] Draft/PathArray--Expected Behavior?

Post by ppemawm »

I am currently working on a model of a roller chain and discovered unusual or unexpected behavior when using the PathArray tool. The following is a simple example of a circular interlinking chain to illustrate the problem:
chain2.jpg
chain2.jpg (20.97 KiB) Viewed 3636 times
The orientation of the links in the PathArray apparently depends on which plane the sketches are created. Note that the base objects (red links) are rotated 90 deg if constructed in the XY plane or the YZ plane. The links are NOT rotated if constructed in the XZ plane:
chain.jpg
chain.jpg (223.53 KiB) Viewed 3636 times
I searched the forum and user documentation but did not find much about PathArrays.
Is this the expected behavior or have I misapplied the PathArray?

The workaround is to simply rotate the base object 90 deg before applying the PathArray. This gets to be a bit confusing when attempting something a little more complicated like a roller chain.

This model was created in the XZ plane to avoid the aforementioned PathArray behavior:
roller_chain.jpg
roller_chain.jpg (59.06 KiB) Viewed 3636 times
OS: Windows 8
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.6706 (Git)
Build type: Release
Branch: releases/FreeCAD-0-16
Hash: f86a4e411ff7848dea98d7242f43b7774bee8fa0
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
Attachments
circular_chain.FCStd
(47.66 KiB) Downloaded 139 times
Last edited by ppemawm on Sun Oct 23, 2016 5:46 pm, edited 1 time in total.
"It is a poor workman who blames his tools..." ;)
User avatar
wandererfan
Veteran
Posts: 6320
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Draft/PathArray--Expected Behavior?

Post by wandererfan »

ppemawm wrote:Is this the expected behavior or have I misapplied the PathArray?
It's a bug, or at least missing functionality. PathArray doesn't know that changing the Placement of a Sketch based object doesn't move it. You need to change the Placement of the Sketch.

I'll try to look deeper tomorrow.

wf.
User avatar
Willem
Veteran
Posts: 1854
Joined: Fri Aug 12, 2016 3:27 pm
Location: Lisse, The Netherlands

Re: Draft/PathArray--Expected Behavior?

Post by Willem »

I agree that behavior in X-Z plane is not logical. There is no need to make a clone. Switch of the direction of the chain can be made with the align function. It looks like the functionality of true and false is flipped for the X-Z plane compared to the other planes. Also placement has a lot if toys for placing the elements.
Schermafdruk van 2016-10-18 09-02-35.png
Schermafdruk van 2016-10-18 09-02-35.png (34.2 KiB) Viewed 3593 times
User avatar
ppemawm
Veteran
Posts: 1240
Joined: Fri May 17, 2013 3:54 pm
Location: New York NY USA

Re: Draft/PathArray--Expected Behavior?

Post by ppemawm »

Willem wrote:I agree that behavior in X-Z plane is not logical.
I think you mean that the behavior in the XZ plane is as expected. It is NOT logical to me in the other planes since the base object in the array is rotated 90 deg when the PathArray is applied with Align/True.
Willem wrote:Switch of the direction of the chain can be made with the align function.
Thanks for pointing that out. It seems that the False condition is as expected for all planes, but the True condition only behaves as I would expect in the XZ plane.

Can anyone confirm this as a bug or is it by design?
"It is a poor workman who blames his tools..." ;)
User avatar
wandererfan
Veteran
Posts: 6320
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Draft/PathArray--Expected Behavior?

Post by wandererfan »

wandererfan wrote:PathArray doesn't know that changing the Placement of a Sketch based object doesn't move it.
Wrong again. :oops:

I looked into the code. The same math is applied to the Base object in all cases. In the XZ case, the Base is rotated too, but you need an asymmetric object to see it (effectively 90* around each axis).
XZPathArray.png
XZPathArray.png (9.27 KiB) Viewed 3540 times
It might be possible to tweak the math for special cases, but I haven't yet come up with a general solution for all base orientations that always results in sensible results.

Another possibility might be a parameter(s) to control the initial placement of the Base objects.

So, not a bug, but maybe a feature request.

wf
Attachments
XZPathArray.fcstd
(36.13 KiB) Downloaded 78 times
User avatar
ppemawm
Veteran
Posts: 1240
Joined: Fri May 17, 2013 3:54 pm
Location: New York NY USA

Re: Draft/PathArray--Expected Behavior?

Post by ppemawm »

wandererfan wrote:So, not a bug, but maybe a feature request.
Thanks wandererfan for looking into this in more detail and clarifying the behavior to be expected. Now that I know how it will always behave I can allow for it before applying the PathArray.
"It is a poor workman who blames his tools..." ;)
User avatar
wandererfan
Veteran
Posts: 6320
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Draft/PathArray--Expected Behavior?

Post by wandererfan »

ppemawm wrote:
wandererfan wrote:So, not a bug, but maybe a feature request.
Thanks wandererfan for looking into this in more detail and clarifying the behavior to be expected. Now that I know how it will always behave I can allow for it before applying the PathArray.
You're welcome, happy to help. Now that you are the official expert PathArray user, maybe you should consider updating the Wiki or making a tutorial! :D
User avatar
ppemawm
Veteran
Posts: 1240
Joined: Fri May 17, 2013 3:54 pm
Location: New York NY USA

Re: Draft/PathArray--Expected Behavior?

Post by ppemawm »

wandererfan wrote:you should consider updating the Wiki or making a tutorial
I am currently working on a spreadsheet driven model of a roller chain and two arbitrary sprockets for a client. Perhaps it can be shared when completed.

I have an approximation, but it has a small error. The chain links, rollers, and pins can be exactly aligned for a given path and number of links, but the rollers do not align perfectly with the sprocket teeth. The rollers should follow the pitch circle of the sprockets. The reason for the error appears to be that only one point on the link (determined by the sketch origin) can be located on the path ,whereas in order to align with the sprocket teeth, the links need to align two points on the path. You can see the small error in the following picture:
roller_chain2.jpg
roller_chain2.jpg (165.7 KiB) Viewed 3472 times
The centroid of the link is located at the origin of the link sketch which minimizes the error in this example. The link sketch itself is located at the global origin. If you try to align one end of the link then the links do not align to each other although the rollers can be exactly aligned with sprockets.
I am still searching for a workaround.
"It is a poor workman who blames his tools..." ;)
chrisb
Veteran
Posts: 54201
Joined: Tue Mar 17, 2015 9:14 am

Re: Draft/PathArray--Expected Behavior?

Post by chrisb »

Let r be the radius of your placement path and l the length of one chain segment. You can reduce the radius by 1/2*sqrt(4 * r^2 - s). This is one of the forumlae for a circle's segment.
If you want some geometric (i.e. FreeCAD)-solution, can you post a simplified model?
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
ppemawm
Veteran
Posts: 1240
Joined: Fri May 17, 2013 3:54 pm
Location: New York NY USA

Re: Draft/PathArray--Expected Behavior?

Post by ppemawm »

chrisb wrote:You can reduce the radius by 1/2*sqrt(4 * r^2 - s).
Yeah had tried that already, it works great, but only if both sprockets have the same radius. I need a more general solution.
"It is a poor workman who blames his tools..." ;)
Post Reply