iLogic in an assembly add dimensions to all part properties

iLogic in an assembly add dimensions to all part properties

Stefan.Rohde
Enthusiast Enthusiast
523 Views
2 Replies
Message 1 of 3

iLogic in an assembly add dimensions to all part properties

Stefan.Rohde
Enthusiast
Enthusiast

Hello.

I have an iLogic rule which writes the component dimensions (LxBxH) in iProperties to me. The problem is that the values are written in a line, however, I need a line for one value, so I can use the columns L and B for the surface calculation in the Excel.

Or is it possible to write immediately the surface in m ² in the Iproperties?

Ideally would be an iLogic rule which I could release in the assembly and all parts get the dimensions and surfaces in the Properties written:-)

0 Likes
524 Views
2 Replies
Replies (2)
Message 2 of 3

GeorgK
Advisor
Advisor

Hello @Stefan.Rohde,

 

please post your code to add the missing part.

 

Georg

0 Likes
Message 3 of 3

Stefan.Rohde
Enthusiast
Enthusiast
Here ist the Code:



Sub Main ()

Dim oDoc As Inventor.Document

Dim oPartDoc As Inventor.PartDocument

Dim oCompDef As Inventor.ComponentDefinition

Dim oFlatExtent As Boolean = False



Try

oDoc = ThisDoc.Document

If oDoc.DocumentType = kPartDocumentObject Then

oPartDoc = oDoc

If oPartDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then

oCompDef = oPartDoc.ComponentDefinition

If oCompDef.HasFlatPattern = True Then

oFlatExtent = True

End If

End If

End If



'set the length units string

Units = oDoc.UnitsOfMeasure.LengthUnits

Select Case Units

Case 11269

UnitString = "mm"

Case 11268

UnitString = "cm"

Case 11270

UnitString = "m"

Case 11272

UnitString = "in"

Case 11273

UnitString = "ft"

End Select



If oFlatExtent = False Then

L = Round(Measure.ExtentsLength,1)

B = Round(Measure.ExtentsWidth, 1)

H = Round(Measure.ExtentsHeight, 1)

iProperties.Value("Custom", "Abmessungen_Bauraum") = L & "x" & B & "x" & H & " " & UnitString

Else

L = Round(SheetMetal.FlatExtentsLength, 1)

B = Round(SheetMetal.FlatExtentsWidth, 1)

iProperties.Value("Custom", "G_L") = L & "x" & B & " " & UnitString

iProperties.Value("Custom", "Blechstärke") = oCompDef.Thickness.Expression

'cross section unfolded model

L = Round(Measure.ExtentsLength,1)

B = Round(Measure.ExtentsWidth, 1)

H = Round(Measure.ExtentsHeight, 1)

iProperties.Value("Custom", "Abmessungen_Bauraum") = L & "x" & B & "x" & H & " " & UnitString

End If

Catch ex As Exception

iProperties.Value("Custom", "Dimensions") = "iLogicRule Error"

iProperties.Value("Custom", "Abmessungen_Bauraum") = "iLogicRule Error"

End Try



End Sub


0 Likes