Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ilogic get parameter from selected component

1 REPLY 1
SOLVED
Reply
Message 1 of 2
DRLTKSE
1674 Views, 1 Reply

ilogic get parameter from selected component

Hi There,

 

I'm trying to use an iLogic rule to display a custom parameter from the selected component. If I put the parameter in iproperties it works just fine, but not with parameters.

 

Thanks for any help.

 

Here is the code:

 

SyntaxEditor Code Snippet

Dim oOccurrence As ComponentOccurrence
Dim PortProp As String
Dim PortNum as Double
Dim PropLen As Double

Try
  oOccurrence = ThisDoc.Document.SelectSet.Item(1)
Catch
  MessageBox.Show("Please select a component before running this rule.", "iLogic")
  Return
End Try

Try
    If TypeOf oOccurrence Is ComponentOccurrenceProxy Then
        PortProp = Parameter.Value(oOccurrence.NativeObject.Name, "PortSize")
    Else 
        PortProp = Parameter.Value(oOccurrence.NativeObject.Name, "PortSize")
    End If
Catch
    MessageBox.Show("Error", "TKSY")
    Return
End Try

MessageBox.Show(PortProp, "TKSY")
Tags (1)
1 REPLY 1
Message 2 of 2
DRLTKSE
in reply to: DRLTKSE

Solved:

 

SyntaxEditor Code Snippet

Try
    If TypeOf oOccurrence Is ComponentOccurrenceProxy Then
        PortProp = Parameter(oOccurrence.NativeObject.Name, "PortSize")
    Else 
        PortProp = Parameter(oOccurrence.Name, "PortSize")
    End If
Catch
    MessageBox.Show("Sort Your Fish Out Mate!", "TKSY")
    Return
End Try

MessageBox.Show(PortProp, "TKSY")

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report