Community
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Using ConvertTo"Type"Constraint in API

Using ConvertTo"Type"Constraint in API

When using for example the ConvertTo FlushConstraint within the API (Example Below) the function will change the constraint that it's using to convert to the new constraint type and then rename it to a new "Flush:#" or "Mate:##" number instead of using the name of the constraint that is being used. In my work, we commonly use custom constraint names in our automation. 

 

 

Video to demonstrate the change of the names in the tree. 

 

	Dim oCon As AssemblyConstraint 
	
	For Each oCon In oAssyDef.Constraints 
		If oCon.Type = kMateConstraintObject Then
			Select oCon.Name 
				Case "PLA 01 ELEV", "PLA 01 IN"
					If strHand = "RH" Then 
						oCon.ConvertToFlushConstraint(oCon.EntityOne, oCon.EntityTwo, "0")
					Else 
						oCon.ConvertToMateConstraint(oCon.EntityOne, oCon.EntityTwo, "0")
					End If
			End Select 
		End If 
		
	Next 

 What I would ask is when using these methods that you have an option to either keep the name or to use the name. This way you do not have to rename the constraint that you are trying to change the type of. 

 

The main methods that I would like to see changed are but I could see all of them needing this functionality. 

Tiffany_Hayden__0-1684178307465.png

 

1 Comment
Tiffany_Hayden_
Collaborator

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

Submit Idea  

Autodesk Design & Make Report