Message 1 of 2
Rotate a flat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi, I am working with a part that is a flat and I am trying to rotate it if the height is greater than the width, I have a code started but I do not know how to access the rotation property to rotate the flat, have you done something similar, do you know if it is possible?
If ThisApplication.ActiveDocument.DocumentType <> DocumentTypeEnum.kPartDocumentObject Then
MessageBox.Show("This script only works on sheet metal (.ipt) files.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Return
End If
Dim oDoc As PartDocument = ThisApplication.ActiveDocument
Dim oCompDef As SheetMetalComponentDefinition = Nothing
Try
oCompDef = oDoc.ComponentDefinition
Catch ex As Exception
MessageBox.Show("This file does not have a defined sheet metal component.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Return
End Try
If oCompDef.HasFlatPattern Then
Dim oFlatPattern As FlatPattern = oCompDef.FlatPattern
Dim oRangeBox As Box = oFlatPattern.RangeBox
Dim height As Double = oRangeBox.MaxPoint.Y - oRangeBox.MinPoint.Y
Dim width As Double = oRangeBox.MaxPoint.X - oRangeBox.MinPoint.X
If height > width Then
MessageBox.Show("The height of the Flat Pattern is greater than its width.", "Notice", MessageBoxButtons.OK, MessageBoxIcon.Information)
Else If width > height
MessageBox.Show("The height of the Flat Pattern is not greater than its width.", "Notice", MessageBoxButtons.OK, MessageBoxIcon.Information)
Else
End If
Else
MessageBox.Show("This file does not have a Flat Pattern defined.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If