To Edit User Parameter from within current Sketch

To Edit User Parameter from within current Sketch

RoyWickrama_RWEI
Advisor Advisor
643 Views
6 Replies
Message 1 of 7

To Edit User Parameter from within current Sketch

RoyWickrama_RWEI
Advisor
Advisor

In my skeleton modeling, the master sketch is too big and contains so many user parameters. Some times, need to edit the user parameter on the fly.

Could I get some iLogic code to edit the user parameter by selecting the dimension (for example, Length_03 as shown below)?

 

To edit User Parameter.png

 

0 Likes
Accepted solutions (1)
644 Views
6 Replies
Replies (6)
Message 2 of 7

MechMachineMan
Advisor
Advisor

In the DIMENSION box, as shown, type:

 

Length_03 = 10

 

where 10 is your new value.

 

No iLogic required.


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 3 of 7

rhasell
Advisor
Advisor

Hi

I have been following this thread, as I have the same question, does this now work in the new version of Inventor?

 

I still only have 2018, and it does not work for "User Parameters", only "Model parameters"

 

Thanks

 

 

 

Reg
2026.1
Message 4 of 7

RoyWickrama_RWEI
Advisor
Advisor

Thanks for the reply.

I have a little code created. But it is lacking to get copied the name of the assigned-user-parameter of the dimension selected.

Please see attached sample file.

I appreciate if you could help.To Get Copied User Parameter Name.png

 

 

0 Likes
Message 5 of 7

RoyWickrama_RWEI
Advisor
Advisor

Thanks. You are right. I need to get around this. I appreciate if you could help.

0 Likes
Message 6 of 7

chandra.shekar.g
Autodesk Support
Autodesk Support
Accepted solution

@RoyWickrama_RWEI,

 

Hoping that below iLogic code would help to edit user parameter of selected dimension.

 

Sub Main()
	Dim oSelectedDim As DimensionConstraint
	oSelectedDim = ThisApplication.Commandmanager.Pick(SelectionFilterEnum.kSketchDimConstraintFilter,"Select a dimension to change dimension")
    
    If oSelectedDim.Parameter.DrivenBy.Count > 0 Then
        Dim oUserParam As UserParameter
        oUserParam = oSelectedDim.Parameter.DrivenBy.Item(1)
        
        oUserParam.Expression = InputBox("Editing user parameter '" & oUserParam.Name & "'", "Edit user parameter", "10") 
    Else
        MsgBox ("Selected dimension is not contianing any user parameter")
    End If

    iLogicVb.UpdateWhenDone = True
End Sub

Please feel free to contact if there is any queries.

 

If solves problem, click on "Accept as solution" / give a "Like".

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Message 7 of 7

RoyWickrama_RWEI
Advisor
Advisor

It works, I keep using.

 

I have a little concern. After editing the user parameter, it closes the sketch being edited. Can I have the sketch remaining so that the other edits too can be done and close the sketch by myself.

 

Thanks.

0 Likes