VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to create new UCS object?

1 REPLY 1
Reply
Message 1 of 2
tothpal
204 Views, 1 Reply

How to create new UCS object?

Hi!
I want to create a new UCS, but the following code doesn't create the new UCS and doesn't send any error message.
The oUCS object still Nothing after the code run. Can anyone help me if the last line is correct or not? ( Set oUCS = ...)

Thanks

Paul


Dim oUCS As AcadUCS
Dim oDOC as AcadDocument
Dim origin(0 To 2) As Double
Dim xAxisPoint(0 To 2) As Double
Dim yAxisPoint(0 To 2) As Double

origin(0) = 2: origin(1) = 2: origin(2) = 0
xAxisPoint(0) = 3: xAxisPoint(1) = 2: xAxisPoint(2) = 0
yAxisPoint(0) =2: yAxisPoint(1) =3: yAxisPoint(2) = 0

Set oDOC=Autocad.ActiveDocument
Set oUCS = oDOC.UserCoordinateSystems.Add(origin, xAxisPoint, yAxisPoint, "UCS1")
1 REPLY 1
Message 2 of 2
fantum
in reply to: tothpal

Works for me but the call to the global Autocad.ActiveDocument looks dangerous.

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

Post to forums  

Autodesk Design & Make Report

”Boost