This wrong:
prOpt.AddAllowedClass(GetType(AlignedDimension), True)
prOpt.AddAllowedClass(GetType(RotatedDimension), True)
prOpt.AddAllowedClass(GetType(ArcDimension), True)
prOpt.AddAllowedClass(GetType(LineAngularDimension2), True)
prOpt.AddAllowedClass(GetType(DiametricDimension), True)
prOpt.AddAllowedClass(GetType(Point3AngularDimension), True)
prOpt.AddAllowedClass(GetType(RadialDimension), True)
prOpt.AddAllowedClass(GetType(RadialDimensionLarge), True)
Instead of all of that, only this is needed:
prOpt.AddAllowedClass(GetType(Dimension), False)
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2008
Supporting AutoCAD 2000 through 2008
http://www.acadxtabs.com
wrote in message news:5622592@discussion.autodesk.com...
Hi
Here is two subs
First one will be to change arrow blocks
for the selected dimension, second one
will be to change system variables
You need to varnish these both because they
are was written quickly
~'J'~
_
Public Sub ChangeArrowBlock()
Dim ed As Editor = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor
Dim db As Database = HostApplicationServices.WorkingDatabase
Dim prOpt As PromptEntityOptions = New PromptEntityOptions(vbCr & "Select Dimension To Change Arrow Block: ")
prOpt.SetRejectMessage(vbCr & "Only Dimensions may be selected.")
prOpt.AddAllowedClass(GetType(AlignedDimension), True)
prOpt.AddAllowedClass(GetType(RotatedDimension), True)
prOpt.AddAllowedClass(GetType(ArcDimension), True)
prOpt.AddAllowedClass(GetType(LineAngularDimension2), True)
prOpt.AddAllowedClass(GetType(DiametricDimension), True)
prOpt.AddAllowedClass(GetType(Point3AngularDimension), True)
prOpt.AddAllowedClass(GetType(RadialDimension), True)
prOpt.AddAllowedClass(GetType(RadialDimensionLarge), True)
Dim rs As PromptEntityResult = ed.GetEntity(prOpt)
If rs.Status = PromptStatus.OK Then
Using trans As Transaction = db.TransactionManager.StartTransaction()
Dim dime As Dimension = CType(trans.GetObject(rs.ObjectId, OpenMode.ForWrite), Dimension)
If Not dime Is Nothing Then
' here we go:
Dim bt As BlockTable = CType(trans.GetObject(db.BlockTableId, OpenMode.ForRead, False), BlockTable)
Dim btr As BlockTableRecord = CType(trans.GetObject(bt.Item("_ARCHTICK"), OpenMode.ForRead), BlockTableRecord)
Dim blkId As ObjectId = btr.ObjectId
Dim dtr As DimStyleTableRecord = dime.GetDimstyleData
dtr.Dimblk = blkId
dtr.Dimblk1 = blkId
dtr.Dimblk2 = blkId
MsgBox(dtr.Name)
dime.SetDimstyleData(dtr)
' if you need to change arrows for dimstyle also:
'db.SetDimstyleData(dtr)
ed.Regen()
Else
MsgBox("You are stumb as always, Fatty")
End If
trans.Commit()
End Using
End If
End Sub
_
Public Sub ChangeArrowBlockSysVar()
Dim ed As Editor = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor
Dim db As Database = HostApplicationServices.WorkingDatabase
Using trans As Transaction = db.TransactionManager.StartTransaction()
Dim bt As BlockTable = CType(trans.GetObject(db.BlockTableId, OpenMode.ForRead, False), BlockTable)
Dim btr As BlockTableRecord = CType(trans.GetObject(bt.Item("_ARCHTICK"), OpenMode.ForRead), BlockTableRecord)
Dim blkId As ObjectId = btr.ObjectId
db.Dimblk = blkId
db.Dimblk1 = blkId
db.Dimblk2 = blkId
trans.Commit()
End Using
End Sub