Quantcast
Channel: Manufacturing DevBlog
Viewing all articles
Browse latest Browse all 531

How to reverse an Insert Constraint Axes?

$
0
0

By Philippe Leefsma

The AxesOpposed property of an InsertConstraint is a ReadOnly property, however it is possible to workaround that limitation using the “ConvertToInsertConstraint” method.

Here is the VBA code for that. It assumes that the constraint(1) is an insert:

Sub ToggleInsertAxes()

    Dim doc As AssemblyDocument
    Set doc = ThisApplication.ActiveDocument
   
    Dim insert As InsertConstraint
    Set insert = doc.ComponentDefinition.Constraints(1)

    Call insert.ConvertToInsertConstraint( _
        insert.EntityOne, _
        insert.EntityTwo, _
        Not insert.AxesOpposed, _
        insert.Distance.value)
  
End Sub


Viewing all articles
Browse latest Browse all 531

Trending Articles