Do something to a selection of dimensions in a model sketch

Do something to a selection of dimensions in a model sketch

danny.lewisA9QBW
Advocate Advocate
214 Views
1 Reply
Message 1 of 2

Do something to a selection of dimensions in a model sketch

danny.lewisA9QBW
Advocate
Advocate

I've found a few forum posts on doing things to model sketch dimensions that use the 

ThisApplication.CommandManager.Pick(SelectionFilterEnum.kSketchDimConstraintFilter, "Select dimension")

but is there a good way to just take all the highlighted/selected dimensions in a sketch and do an operation on all the selected dimensions like that?

eg. I'm going to check what custom parameter the dimension is referencing and point it to a different custom parameter.

0 Likes
215 Views
1 Reply
Reply (1)
Message 2 of 2

WCrihfield
Mentor
Mentor

Hi @danny.lewisA9QBW.  I am not sure if that is possible, because the DimensionConstraint.Parameter property is ReadOnly, and returns an Inventor.Parameter type object.  You can review the following iLogic rule to look into it further.  When you pre-select objects before running a rule, they will be found in the Document.SelectSet collection.

 

Dim oDoc As Document = ThisDoc.Document
Dim oSS As SelectSet = oDoc.SelectSet 'where pre-selected stuff will be
If oSS.Count = 0 Then Exit Sub 'exit rule, because nothing was pre-selected
Dim oDimConsraints As New List(Of Inventor.DimensionConstraint)
For Each oObj In oSS
	If TypeOf oObj Is DimensionConstraint Then
		oDimConsraints.Add(oDimConst)
	End If
Next 'oObj
For Each oDimConst In oDimConsraints
	MsgBox("Dimension Parameter Name = " & oDimConst.Parameter.Name,,"iLogic")
Next

 

Edit:  However, you may be able to get the Parameter that it returns, then put the name of some other parameter within its Parameter.Expression, which is essentially the same as what you see in the equation column of the parameters dialog.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes