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

How to change UCS in the code

1 REPLY 1
Reply
Message 1 of 2
wesbird
333 Views, 1 Reply

How to change UCS in the code

I must lost my mind. This is should be simple. please forgive me.
In AutoCAD, we can type UCS, new, then create a new UCS whatever you want.
In C#, How I can do it?
I found how to create a UcsTableRecord just like create a new layer. but I have no idea to set the UCS I just created current.
At autocad command line, I can type UCS, Restore, and then the name of UCS.
In VBA, ThisDrawing.ActiveUCS = ... do the job.
I would not use SendCommandToString.
Is there any thing I am missing?



Thank you
Wes Message was edited by: weslleywang
Windows 10 64 bit, AutoCAD (ACA, Map) 2023
1 REPLY 1
Message 2 of 2
Anonymous
in reply to: wesbird

Public Sub ChangeUcsByLine(ByVal lineObj As AcadLine, ByVal strName As String)

'Fait un offset de la ligne pour trouver l'axe Y
Dim offsetObj As Object
offsetObj = lineObj.Offset(10)
Dim offsetLineObj As AcadLine = offsetObj(0)

docObj.UserCoordinateSystems.Add(lineObj.StartPoint, lineObj.EndPoint, offsetLineObj.StartPoint, strName)
docObj.ActiveUCS = docObj.UserCoordinateSystems.Item(strName)

offsetLineObj.Delete()

End Sub

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost