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: 

Assign multiple parameters with the same value

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
cadmanagershat
546 Views, 4 Replies

Assign multiple parameters with the same value

Could anybody help me with this one please?

 

I am currently applying dimensions/constraints to our company logo with a view to creating an ifeature which we can insert at different scales across a range of products.

I am looking at creating a user parameter for scale (value of 1) which I can then assign to all other parameters as *scale. Problem is the total number of parameters concerned is scary so I am looking for a quick way to do this.

Any ideas?

4 REPLIES 4
Message 2 of 5
salariua
in reply to: cadmanagershat

They are not so scarry if you export them and edit the xml with notepad or something similar where you can do a search replace.

Adrian S.
blog.ads-sol.com 

AIP2012-2020 i7 6700k AMD R9 370
Did you find this reply helpful ?
If so please use the Accepted Solutions or Like button - Thank you!
Message 3 of 5
ekinsb
in reply to: cadmanagershat

Here's a small VBA macro you can try.  It assumes the name of the parameter controlling the scale is "Scale".

 

Public Sub SetScaleOnParameters()
    Dim partDoc As PartDocument
    Set partDoc = ThisApplication.ActiveDocument
    Dim partDef As PartComponentDefinition
    Set partDef = partDoc.ComponentDefinition
    
    Dim modelParam As ModelParameter
    For Each modelParam In partDef.Parameters.ModelParameters
        ' Check to see that this parameter defines a distance.
        If partDoc.UnitsOfMeasure.CompatibleUnits("1", modelParam.Units, "1", "in") Then
            ' Change the expression to include scale.
            modelParam.Expression = modelParam.Expression & " * Scale"
        End If
    Next
End Sub

 


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Message 4 of 5
cadmanagershat
in reply to: ekinsb

With a little tinkering that's done the trick.

Thank you very much

Message 5 of 5
WHolzwarth
in reply to: ekinsb

Hmm. It's late, but I think, I've found an issue. Not all linear parameters are changed after applying Scale. See attached screenshots.

Parameters d16 and d39 are changed to (lh / 3 oE) - topthk * Scale, but should be (lh / 3 oE) * Scale - topthk * Scale. oE is German impression for ul = unitless.

 

Walter

 

Parameters before Scale.jpg

 

 

Parameters after Scale.jpg

Walter Holzwarth

EESignature

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

Post to forums  

Autodesk Design & Make Report