Community
AutoCAD Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Dimension In 3d Using VB.Net

2 REPLIES 2
Reply
Message 1 of 3
NEP_perpetual
578 Views, 2 Replies

Dimension In 3d Using VB.Net

I'm writing a .Net extension for AutoCAD and I've been unsucessful in trying to make dimensions in 3d (i.e. on the z axis).  Here is the code that I'm have to try to accomplish this:

 

Dim doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
Dim db = doc.Database
Dim ed = doc.Editor

Using trx As Transaction = db.TransactionManager.StartTransaction()

	' Open the Block table for read
	Dim bt As BlockTable = TryCast(db.BlockTableId.GetObject(OpenMode.ForRead), BlockTable)
	' Open the Block table record Model space for write
	Dim acBlkTblRec As BlockTableRecord = trx.GetObject(bt(BlockTableRecord.ModelSpace), OpenMode.ForWrite)

	' Create the dimension
	Dim acRotDim As RotatedDimension = New RotatedDimension()
	acRotDim.SetDatabaseDefaults()
	acRotDim.XLine1Point = New Point3d(120, 120, 0)
	acRotDim.XLine2Point = New Point3d(120, 120, 120)
	acRotDim.DimLinePoint = New Point3d(140, 120, 0)

	' Add the new object to Model space and the transaction
	acBlkTblRec.AppendEntity(acRotDim)
	trx.AddNewlyCreatedDBObject(acRotDim, True)
trx.Commit() End Using

 

When this code is run the dimension is created and the extension line snaps are in the correct places.  However, the lines and text are stuck on the "ground" and it's shows a distance of 0.  How can I create the dimension so that it's on the right plane?

2 REPLIES 2
Message 2 of 3

Hi,

 

I guess the dimenstion shows 0 as it's object coordinate system is not parallel to Z-axis, if the OCS is the same as the XY-plane then the distance between that 2 points (in XY-plane) is 0 and that is correct.

 

Just as info: there is a special .NET forum >>>here<<<. It might help to search there (and to ask questions).

 

HTH, - alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)
Message 3 of 3

I didn't see the .Net forum, thanks for directing me to it.

 

I've posted my question here.

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

Post to forums  

Autodesk Design & Make Report

”Boost