Flat Pattern FlipAlignmentAxis help needed....

Flat Pattern FlipAlignmentAxis help needed....

speterso
Contributor Contributor
673 Views
3 Replies
Message 1 of 4

Flat Pattern FlipAlignmentAxis help needed....

speterso
Contributor
Contributor

How does one know if the FlipAlignmentAxis is positive or negative via code?  

 

I am using C# but I can do the VB.Net conversion myself if needed.

 

Reason for needing to know this is when I do the FlatPatternOrientation changes, some files require the FlipAlignmentAxis set to true and some don't.  I am guessing it is sometimes the axis is negative but should be positive etc.  I will need to test on this data and set the FlipAlignmentAxis accordingly so every part being processed by my code generates the desired orientation.  Everything is good in all the files tested except a handful seemed to orient upside down and if I manually process through the steps it is the FlipAlignmentAxis that is causing this issue.  I currently set the FlipAlignmentAxis to "true" only, and for these few files it needs to be set to false because it is already correct.

 

I am guessing here that I want them all to be positive and a few are already set to positive by default and when I set the FlipAlignmentAxis to true it orients incorrectly (upside down).  If it is not just finding neg or pos let me know what else I can key on to ensure my alignment is correct.

 

 

current code:

 

SheetMetalComponentDefinition ShtMtlCompDef = PRTDoc.ComponentDefinition as SheetMetalComponentDefinition;

FlatPatternOrientation FltPatOrient = ShtMtlCompDef.FlatPattern.FlatPatternOrientations.ActiveFlatPatternOrientation.Copy("Default");

.

<ShtMtlEdge is right most verticle edge on the A-SideFace>

.

FltPatOrient.Activate();

FltPatOrient.AlignmentAxis = ShtMtlCompDef.FlatPattern.GetFlatPatternEntity(ShtMtlEdge) as Edge;
FltPatOrient.AlignmentType = AlignmentTypeEnum.kVerticalAlignment;
FltPatOrient.FlipAlignmentAxis = true;
FltPatOrient.FlipBaseFace = true;

 

I believe I need to add a condition to only set FltPatOrient.FlipAlignmentAxis = true; (or to false) based on some information.  I just don't know where to look for this information in the inventor sheet metal object model or how to handle if this should be applied or not via program only.   It is easily enough noticeable when working with the part in person but not sure how to determine this via code only.

 

If anyone has any idea please help

 

Thank You

 

Shannon

0 Likes
Accepted solutions (1)
674 Views
3 Replies
Replies (3)
Message 2 of 4

YuhanZhang
Autodesk
Autodesk
Accepted solution

The FlatPatternOrientation defines a 2D coordinate system on the FlatPattern.BaseFace, the X and Y coordinates are defined using below properties combinations of FlatPatternOrientation:

 

AlignmentType

AlignmentAxis

FlipAlignmentAxis

AlignmentRotation

FlipBaseFace

 

Below is the algorithm to determine the X&Y coordinates:

 

1. The AlignmentType defines which coordinate will be along the AlignmentAxis edge. kHorizontalAlignment indicates the X-coordinate will align with the  AlignmentAxis, and the kVerticalAlignment indicates the Y-coordinate will align with the AlignmentAxis  edge. So this property will specify the alignment-coordinate(X or Y).

2. The alignment-coordinate direction as default should align with the direction of the AlignmentAxis(as the AlignmentAxis is an Edge you can get the direction using AlignmentAxis.Geometry.Direction).

3. If the FlipAlignmentAxis is set to True, then the alignment-coordinate direction will be opposed to the direction of the FlipAlignmentAxis.

4. The AlignmentRotation will rotate the alignment-coordinate. This is clockwise.

5. Using above four properties you should be able to calculate the alignment-coordinate, while you also need to calculate the other coordinate. Assume that the alignment-coordinate is X-coordinate(the AlignmentType = kHorizontalAlignment in this case), now we need to determine the Y-coordinate, so the FlipBaseFace should be considered now. If the FlipBaseFace is False, then the normal of the FlatPatter.BaseFace is regarded as Z-coordinate, and so you can use the X-coordinate and Z-coordinate to calculate the Y-coordinate, if the FlipBaseFace is True then the Y-coordinate will also be flipped.

 

 

So use the above algorithm you can decide if you need to set the FlipAlignmentAxis. Hope it helps.



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

Message 3 of 4

t_hascj
Autodesk
Autodesk

Hi speterso,

The FlipAlignemntAxis whether alignment direction of flat pattern orientation is the opposite of the natural direction of the alignment axis. FlatPatternOrientation.FlipAlignmentAxis Property

You need to analyze AligmentAxis edge for get the information if you need to flip or not.

FltPatOrient.AlignmentAxis = ShtMtlCompDef.FlatPattern.GetFlatPatternEntity(ShtMtlEdge) as Edge;


Thanks,
Jaroslav

 

EDIT: Sorry for duplicate post. I was slow :). 

0 Likes
Message 4 of 4

speterso
Contributor
Contributor

Want to thank both of you for your replies.  I gave the accept as solution to the first response, it had more detail for me to use to figure out what I needed to do.

 

Was hoping for a nice neat and genral way to handle all cases a flat pattern can be created but looks like I needed to handle may conditions based on info as it is created to figure out how to handle the FlipAlignmentAxis and apply the information correctly one condition even required me to apply a 90deg rotate or it just would not work correctly.  My test pieces I was given work correctly now and I do expect more parts to come my way that don't process right and will just have to handle them as they come in until I get a full set of conditions handled for any part the engineers create.

 

Once again Thanks for the help

 

Shannon

0 Likes