Rotate a flat model before converting into DXF

Rotate a flat model before converting into DXF

arese
Observer Observer
184 Views
1 Reply
Message 1 of 2

Rotate a flat model before converting into DXF

arese
Observer
Observer
Dim oCompDef As SheetMetalComponentDefinition
oCompDef = oDrawDoc.ComponentDefinition
If oCompDef.HasFlatPattern = False Then
oCompDef.Unfold
Else
oCompDef.FlatPattern.Edit
End If
Dim flatPattern As FlatPattern
flatPattern = oCompDef.FlatPattern
 
' Calculate X and Y lengths
lengthX = flatPattern.Width*10
lengthY = flatPattern.Length*10
'MessageBox.Show(lengthX)
'MessageBox.Show(lengthY)
If lengthY > lengthX Then
rotationAngle As Double = Math:PI/ 2
'angle = 90.0
oCompDef.RotationParameters[1].Value = rotationAngle
'End If
 
Dim sOut As String
sOut = "FLAT PATTERN DXF?AcadVersion=2000" & _
       "&InvisibleLayers=IV_TANGENT;IV_FEATURE_PROFILES;IV_ARC_CENTERS;IV_BEND;IV_BEND_DOWN;IV_TOOL_CENTER;IV_TOOL_CENTER_DOWN;IV_FEATURE_PROFILES_DOWN" & _
   "&RebaseGeometry=True"

 

 

Hello everyone,

this is part of the code I wrote, we are trying to convert the singles .ipt components of ".IAM" , but before that we need to check the length in x and y and rotate the flat part so that the longest one is on the x Axys.  I tried plenty of options to rotate it, in the code you see  "oCompDef.RotationParameters[1].Value = rotationAngle", this is just the last try I did before asking for help here. My problem is that I usually program on others platforms, I don't usually use Inventor and iLogic. I'm asking you if there's a proper command to do it, I'll need it just for a few files, and I'll rotate them of 90°. I am also trying to do it using vba in Microsoft Excel, by editing the dxf file like plain text, so if you have any idea, thanks a lot.  

0 Likes
185 Views
1 Reply
Reply (1)
Message 2 of 2

A.Acheson
Mentor
Mentor

Hi @arese 

If you declare the flat PatternOrientation object you can get to the correct method. Here is the API help for this object

AAcheson_0-1694831186655.png

Dim oCompDef As SheetMetalComponentDefinition = ThisDoc.Document.ComponentDefinition
If oCompDef.HasFlatPattern = False Then
	oCompDef.Unfold
Else
	oCompDef.FlatPattern.Edit
End If

Dim flatPattern As FlatPattern = oCompDef.FlatPattern
Dim flatPatternOrient As FlatPatternOrientation = flatPattern.FlatPatternOrientations.ActiveFlatPatternOrientation
flatPatternOrient.AlignmentRotation.Expression = 90 ' Document Units of Deg
flatPatternOrient.AlignmentRotation.Value = 1.570796 ' value in Inventor DataBase Units Radians

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes