UCS Constraint Set

UCS Constraint Set

GeorgK
Advisor Advisor
491 Views
3 Replies
Message 1 of 4

UCS Constraint Set

GeorgK
Advisor
Advisor

Hello together,

 

is there a function to set a constraint set or do I have to constrains the planes manually?

 

http://help.autodesk.com/view/INVNTOR/2017/ENU/?guid=GUID-7CD1FD1D-9095-4C53-A0F4-6FFBACC955E1

 

How could I suppress all the constraints of a set?

 

Thank you

 

Georg

 

 

0 Likes
492 Views
3 Replies
Replies (3)
Message 2 of 4

chandra.shekar.g
Autodesk Support
Autodesk Support

Hi @GeorgK,

 

Hoping that following blog article would help.

 

http://adndevblog.typepad.com/manufacturing/2014/07/create-ucs-constraints.html

 

Can you please provide more details on "Suppression of constraints"? What is meant by "UCS constraint set"?

 

Are you talking about the constraints which used UCS as entities?

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 3 of 4

GeorgK
Advisor
Advisor

Hello @chandra.shekar.g,

 

thank you for the link.  I found it already. I am talking about the constraints which are used by the UCS.

 

Abhängigkeit_platzieren.png

 

Thank you

 

Georg

0 Likes
Message 4 of 4

chandra.shekar.g
Autodesk Support
Autodesk Support

Hi @GeorgK

 

Through UI, Constraint sets by selecting UCS does 3 flush constraints for YZ, XZ and XY planes of 2 UCS(User coordinate system). Unfortunately, No direct Inventor API is available.

 

But, same can be achieved by following VBA code.

 

Sub Main()
    
    Dim oUCS1 As UserCoordinateSystem
    Set oUCS1 = ThisApplication.CommandManager.Pick(kUserCoordinateSystemFilter, "Select a first UCS")
    
    Dim oUCS2 As UserCoordinateSystem
    Set oUCS2 = ThisApplication.CommandManager.Pick(kUserCoordinateSystemFilter, "Select a second UCS")
    
    Dim oDOc As AssemblyDocument
    Set oDOc = ThisApplication.ActiveDocument
    
    Dim oDef As AssemblyComponentDefinition
    Set oDef = oDOc.ComponentDefinition
    
    Dim occDef1 As ComponentDefinition
    Set occDef1 = oUCS1.Parent
    
    Dim occ1 As ComponentOccurrence
    
    For Each occ1 In oDef.Occurrences.AllLeafOccurrences
        If occ1.Definition Is occDef1 Then
            Exit For
        End If
    Next
    
    Dim occDef2 As ComponentDefinition
    Set occDef2 = oUCS2.Parent
    
    Dim occ2 As ComponentOccurrence
    
    For Each occ2 In oDef.Occurrences.AllLeafOccurrences
        If occ2.Definition Is occDef2 Then
            Exit For
        End If
    Next
    
    Dim yzPlane1 As WorkPlane
    Set yzPlane1 = oUCS1.YZPlane
    Dim yzProxy1 As WorkPlaneProxy
    Call occ1.CreateGeometryProxy(yzPlane1, yzProxy1)
    
    Dim xzPlane1 As WorkPlane
    Set xzPlane1 = oUCS1.xzPlane
    Dim xzProxy1 As WorkPlaneProxy
    Call occ1.CreateGeometryProxy(xzPlane1, xzProxy1)
    
    Dim xyPlane1 As WorkPlane
    Set xyPlane1 = oUCS1.xyPlane
    Dim xyProxy1 As WorkPlaneProxy
    Call occ1.CreateGeometryProxy(xyPlane1, xyProxy1)
    
    Dim yzPlane2 As WorkPlane
    Set yzPlane2 = oUCS2.YZPlane
    Dim yzProxy2 As WorkPlaneProxy
    Call occ2.CreateGeometryProxy(yzPlane2, yzProxy2)
    
    Dim xzPlane2 As WorkPlane
    Set xzPlane2 = oUCS2.xzPlane
    Dim xzProxy2 As WorkPlaneProxy
    Call occ2.CreateGeometryProxy(xzPlane2, xzProxy2)
    
    Dim xyPlane2 As WorkPlane
    Set xyPlane2 = oUCS2.xyPlane
    Dim xyProxy2 As WorkPlaneProxy
    Call occ2.CreateGeometryProxy(xyPlane2, xyProxy2)
    
    Call oDef.Constraints.AddFlushConstraint(yzProxy1, yzProxy2, 0)
    Call oDef.Constraints.AddFlushConstraint(xzProxy1, xzProxy2, 0)
    Call oDef.Constraints.AddFlushConstraint(xyProxy1, xyProxy2, 0)
    
End Sub

Please feel free to contact if there is any queries,

 

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

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes