You are on page 1of 1

'set a reference to the assembly component definition.

'This assumes an assembly document is open.


Dim a1 As DrawingDocument
a1 = ThisApplication.ActiveDocument

Dim b1 As DocumentsEnumerator
b1 = a1.ReferencedDocuments

'define pos rep


Dim c1 As Object
Dim MyArrayList As New ArrayList

For Each c1 In b1
MyArrayList.Add(c1.DisplayName)
Next

iArrayList = MyArrayList.Count

c1 = InputListBox("Select from the list:", MyArrayList, "iLogic", "Positional Reps")

Dim drawDoc As DrawingDocument


drawDoc = ThisApplication.ActiveDocument

Dim oAsmCompDef As DocumentsEnumerator


oAsmCompDef = drawDoc.ReferencedDocuments

Dim b As AssemblyDocument
b = oAsmCompDef.Item(1)

Dim c As AssemblyComponentDefinition
c = b.ComponentDefinition

Dim oMass As Double

oMass = c.MassProperties.Mass
oMass = Round(oMass, 3)
'---------------------------------------------------------------------------------------------
-
'Promt the user for the value of a variable
myprop = InputBox("Please Enter the Custom Property Here", "Custom Property Input Box", "The
Default Entry")

' Checks to see if custom iproperty etch_number exists, creates it if it is not in document
' Sets value of EtchNumber iprop

Dim a As String = iProperties.Value("Project", "Part Number")


a = a.Replace("-","")
a = a.Substring(4)

Dim oProName As String = myprop


Dim oProSet As Inventor.PropertySet = ThisApplication.ActiveDocument.PropertySets.Item("User
Defined Properties")
' Look for custom iproperty and try to use it

Dim oProp As Inventor.Property


Try
oProp = oProSet.Item(oProName)
Catch
' iProperty not found , create and assign value
oProp = oProSet.Add("",oProName)
End Try

oProp.Expression = oMass

You might also like