Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
chandra.shekar.g
in reply to: GeorgK

Hi @GeorgK,

 

Try the following VBA code to select the UCS and create the same in AssemblyDocument.

 

Sub Main()

    Dim oDoc As AssemblyDocument
    Set oDoc = ThisApplication.ActiveDocument
    
    Dim oDef As AssemblyComponentDefinition
    Set oDef = oDoc.ComponentDefinition

    Dim oUCS As UserCoordinateSystem
    Set oUCS = ThisApplication.CommandManager.Pick(kUserCoordinateSystemFilter, "Select UCS")
    
    Dim oMatrix As Matrix
    Set oMatrix = oUCS.Transformation
       
    Dim oUCSDef As UserCoordinateSystemDefinition
    Set oUCSDef = oDef.UserCoordinateSystems.CreateDefinition
    
    oUCSDef.Transformation = oMatrix
    
    Dim copiedUCS As UserCoordinateSystem
    Set copiedUCS = oDef.UserCoordinateSystems.Add(oUCSDef)
    
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