New Member
Posts: 2
Registered: ‎08-07-2006
Message 1 of 2 (108 Views)

Twist UCS

108 Views, 1 Replies
08-07-2006 05:58 PM
I am trying do get started using

Dim db As DatabaseServices.Database = acadApp.DocumentManager.MdiActiveDocument.Database
Dim trans As DatabaseServices.Transaction = db.TransactionManager.StartTransaction
Dim docLock As DocumentLock = acadApp.DocumentManager.MdiActiveDocument.LockDocument(DocumentLockMode.Write, "CrosshairAlignmentMagLevel", "CrosshairAlignmentMagLevel", True)

Dim ucsTbl As UcsTable = DirectCast(trans.GetObject(db.UcsTableId, DatabaseServices.OpenMode.ForWrite, False), UcsTable)
Dim ucsRec As UcsTableRecord = DirectCast(trans.GetObject(ucsTbl(UcsTableRecord.ModelSpace), DatabaseServices.OpenMode.ForWrite, False), UcsTableRecord)

ucsRec.Origin = New Point3d(19, 109, -55)
ucsRec.XAxis = New Vector3d(1, 0, 0)
ucsRec.YAxis = New Vector3d(0, 1, 0)

I seem to be having trouble accesing the UCSRableRecord so I can move and twist the UCS and update the database.

Should I be looking to do a dllimport on AcDbUCSTableRecord. There is no mention of adjusting a UCS in .net but it's done in the ARX group.

Thanks for any input in advance

New Member
Posts: 2
Registered: ‎08-07-2006
Message 2 of 2 (108 Views)

Re: Twist UCS

08-07-2006 10:07 PM in reply to: MBarnes
I found a mistake in that line and fixed it

Dim ucsRec As UcsTableRecord = DirectCast(trans.GetObject(ucsTbl("testUCS"), DatabaseServices.OpenMode.ForWrite, False), UcsTableRecord)

I can now access the UCS and apply methods to it, it takes all the parameters I pass to it (origin, xAxis, yAxis)......

After the transaction is completed the UCS does not move, even tried a regen but somethings still wrong
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.