Quantcast
Channel: Autodesk AutoCAD forums
Viewing all articles
Browse latest Browse all 14319

Unnamed UCS

$
0
0

Dear All

I have been struggling in a certain code using vb.net and I really need help. I searched the internet but to no avail.

 

Before putting the code on, let me explain to you my problem: My assembly reads a dwg that contains an unnamed UCS in a viewport of a certain layout. All I need is to read that UCS. I found that unnamed UCSs are not found in the UCS tables, so the only suggested way was to use the editor property CurrentUserCoordinateSystem. I am using this way but always failing.

The steps I am following are:

1- activate the layout

2- switch to model space

3- read the CurrentUserCoordinateSystem

 

But I am always getting the WCS and not the UCS in the viewport. An important note is that, if I activate the model space of the viewport then run my assembly, it would work and get the actual UCS. Please help me figuring out the problem, it is taking me days without success. Here is the code:

 

lytmgr.CurrentLayout = pstrres.StringResult
ed.SwitchToModelSpace()
ucs = ed.CurrentUserCoordinateSystem
ed.WriteMessage(vbLf & "UCS is " & ucs.ToString)
Dim dmat As Double() = ucs.ToArray()
dmat(3) = 0
dmat(7) = 0
dmat(11) = 0
ucs = New Matrix3d(dmat)
ucs = ucs.Transpose()
ed.WriteMessage(vbLf & "Real ucs is " & ucs.ToString)
ed.SwitchToPaperSpace()

 

 

Thanks in advance


Viewing all articles
Browse latest Browse all 14319

Trending Articles