Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Create user parameter values with iLogic

20 REPLIES 20
SOLVED
Reply
Message 1 of 21
karthur1
7592 Views, 20 Replies

Create user parameter values with iLogic

Curtis W. has this macro for writing the sheetmetal Extents width and length to the custom properties.  I need to get these values into the part parameters so that they can be used in the BOM.

 

I can get this to work if I manually create the "SM_Length" user parameter, but how do I make the iLogic CREATE the parameters if they do not already exist?  I think it would be something added below the "Catch..." just cant seem to figure out what it needs to be.

'look for custom iproperty and try to set it
Try
iProperties.Value("Custom", sExtLength)=Round(SheetMetal.FlatExtentsLength, iRoundValue)
Parameter("SM_Length")=Round(SheetMetal.FlatExtentsLength,4)

Catch
' assume error means not found and create it
customPropertySet.Add(Round(SheetMetal.FlatExtentsLength,iRoundValue), sExtLength)
EndTry

20 REPLIES 20
Message 21 of 21

Thanks this rule works but I need it to create it a metric parameter

 

Imports  Inventor.UnitsTypeEnum
        
Dim oParams As Parameters
oParams=ThisDoc.Document.ComponentDefinition.Parameters
                
Dim oUserParams As UserParameters
oUserParams=oParams.UserParameters     

'look for user parameter and try to set it                Try
oUserParams("widthExtents").Value = SheetMetal.FlatExtentsLength *2.54
Catch
' assume error means not found and create itoUserParams.AddByValue("widthExtents", SheetMetal.FlatExtentsLength *2.54, kInchLengthUnits) 
End Try

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

Post to forums  

Autodesk Design & Make Report