Toggle between two dimensions

Toggle between two dimensions

A.K.CORTEL
Enthusiast Enthusiast
277 Views
2 Replies
Message 1 of 3

Toggle between two dimensions

A.K.CORTEL
Enthusiast
Enthusiast

Hi all users, I have a part file with a sketch fully constrained, I'm wondering if it's possible switching between deg and height.
Any code that will do the job?
Thanks

0 Likes
Accepted solutions (1)
278 Views
2 Replies
Replies (2)
Message 2 of 3

WCrihfield
Mentor
Mentor
Accepted solution

Hi @A.K.CORTEL.  Here is something that should work for that.

Dim oPDoc As PartDocument = ThisDoc.Document
Dim oPDef As PartComponentDefinition = oPDoc.ComponentDefinition
Dim oSketch As PlanarSketch = oPDef.Sketches.Item("CONICAL")
Dim oDims As DimensionConstraints = oSketch.DimensionConstraints
Dim oHeightDim As DimensionConstraint
Dim oAngleDim As DimensionConstraint
For Each oDim As DimensionConstraint In oDims
	If oDim.Parameter.Name = "d84" Then
		oHeightDim = oDim
	ElseIf oDim.Parameter.Name = "CA" Then
		oAngleDim = oDim
	End If
Next
If oHeightDim.Driven Then
	oAngleDim.Driven = True
	oHeightDim.Driven = False
Else
	oHeightDim.Driven = True
	oAngleDim.Driven = False
End If

If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 3

A.K.CORTEL
Enthusiast
Enthusiast

Hi WCrihfield, it worked perfect.

You are always helpful.

Thank you.

 

0 Likes