iLogic to extract Sheet Metal Data

iLogic to extract Sheet Metal Data

b.mccarthy
Collaborator Collaborator
72 Views
0 Replies
Message 1 of 1

iLogic to extract Sheet Metal Data

b.mccarthy
Collaborator
Collaborator

Hello.

 

I have been using a rule I found on this forum. I do not know who wrote it:

 

'Checks to see if kFactor, SheetStyle, FlatLength & FlatWidth parameters exist, and generates them, if not

'Source code for text parameter check

'Dim oPartDoc As PartDocument = ThisDoc.Document
'Dim oPartCompDef As PartComponentDefinition = oPartDoc.ComponentDefinition
'oParams = oPartCompDef.Parameters
'Dim oUserParams As UserParameters = oParams.UserParameters

'Try
'  p = Parameter("MyParameter")
'Catch
'  oUserParams.AddByValue("MyParameter","MyValue", UnitsTypeEnum.kTextUnits)
'End Try

Dim oApp As Inventor.Application = ThisApplication
Dim oParams As Parameters
'Dim oPartDoc As PartDocument = oApp.ActiveDocument
Dim oPartDoc As PartDocument = ThisDoc.Document
Dim oPartCompDef As PartComponentDefinition = oPartDoc.ComponentDefinition
oParams = oPartCompDef.Parameters
Dim oUserParams As UserParameters = oParams.UserParameters

'kFactor
Try
  p = Parameter("kFactor")
Catch
  oUserParams.AddByValue("kFactor", SheetMetal.ActiveKFactor, UnitsTypeEnum.kUnitlessUnits)
End Try
Parameter("kFactor") = SheetMetal.ActiveKFactor
iProperties.Value("Custom", "kFactor") = SheetMetal.ActiveKFactor

'SheetStyle
Try
  p = Parameter("SheetStyle")
Catch
  oUserParams.AddByValue("SheetStyle", SheetMetal.GetActiveStyle(), UnitsTypeEnum.kTextUnits)
End Try
Parameter("SheetStyle") = SheetMetal.GetActiveStyle() 
iProperties.Value("Custom", "Sheet Style") = SheetMetal.GetActiveStyle() 

'FlatLength
Try
  p = Parameter("FlatLength")
Catch
  oUserParams.AddByValue("FlatLength", SheetMetal.FlatExtentsLength, UnitsTypeEnum.kDefaultDisplayLengthUnits)
End Try
Parameter("FlatLength") = SheetMetal.FlatExtentsLength

'FlatWidth
Try
  p = Parameter("FlatWidth")
Catch
  oUserParams.AddByValue("FlatWidth", SheetMetal.FlatExtentsWidth, UnitsTypeEnum.kDefaultDisplayLengthUnits)
End Try
Parameter("FlatWidth") = SheetMetal.FlatExtentsWidth

'dArea
Try
  p = Parameter("dArea")
Catch
  oUserParams.AddByValue("dArea", 0, "ul")
End Try

'FlatArea
Try
  p = Parameter("FlatArea")
Catch
  oUserParams.AddByValue("FlatArea", 0, "ft^2")
End Try



'Forces update after rule runs 
iLogicVb.UpdateWhenDone = True

This rule functions well, as I only needed the 1st four values from the part. I now need the other two values, however the dArea and FlatArea parameters are not populating correctly. Both return zero values. I am not sure what the dArea value is actually supposed to be reporting.

 

I would like an explanation of what the dArea parameter actually is, and to see this rule return is two values:

  • The actual flat pattern area, (not 'FlatWidth x FlatLength') disregarding any perforations, holes, etc.
  • The flat area with all perforations.

I have attached a simple folded part. Using the Measure tool, Inventor calculates the flat area with hole as 416.230484254 in². Without the hole, this value is 444.504818136 in²

 

TIA

0 Likes
73 Views
0 Replies
Replies (0)