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: 

UserParamter

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
GeorgK
239 Views, 2 Replies

UserParamter

Hello together,

 

I create a Userparamter:

 

 

Public Sub CreateTextUserParameter()
    Dim oDoc As PartDocument
    Set oDoc = ThisApplication.ActiveDocument
    
    Dim oUserParameters As UserParameters
    Set oUserParameters = oDoc.ComponentDefinition.Parameters.UserParameters
    
    Dim oTextParam As UserParameter
    Set oTextParam = oUserParameters.AddByValue("Printer_Name", "3DPrinter", kTextUnits)
       
End Sub

 

This does not work:

 

Dim oParam As Parameter

        For Each oParam In doc.ComponentDefinition.Parameters
            If oParam.Name = "Printer_Name"  Then
                If oParam.Expression = "3DPrinter" Then

                               MsgBox(oParam.Expression)
                End If
            End If
        Next

 

But how could I check if the value exists and get the textvalue?

 

Thank you Georg

2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: GeorgK

Hi,

Kindly find the code below which works

 

Dim oParam As Parameter
doc = ThisApplication.ActiveDocument
For Each oParam In doc.ComponentDefinition.Parameters
MsgBox(oParam.Name +" -- " +oParam.Expression)
If oParam.Name = "Printer_Name" Then
If oParam.Expression = """3DPrinter""" Then

MsgBox(oParam.Expression)
End If
End If
Next


Message 3 of 3
GeorgK
in reply to: Anonymous

Thak you very much. That solves the problem.

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

Post to forums  

Autodesk Design & Make Report