Message 1 of 3
How to Add AEC Space?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
ACA 2012
I am trying to figure out how to insert a 2D AEC Space with .net. Using the code below, it appears as though a space is created but it shows up as only the "triangular error symbol". I can select the symbol and it displays in the properties palette as a space, Can anyone point me in the right direction as to the proper way to add an AEC Space?
Thanks.
Chris
Using acTrans As Transaction = db.TransactionManager.StartTransaction()
Dim acBlkTbl As BlockTable
acBlkTbl = acTrans.GetObject(db.BlockTableId, OpenMode.ForRead)
Dim acBlkTblRec As BlockTableRecord
acBlkTblRec = acTrans.GetObject(acBlkTbl(BlockTableRecord.ModelSpace), OpenMode.ForWrite)
Dim myPPO As New PromptPointOptions("Pick first point: ")
myPPO.AllowNone = True
myPPO.UseBasePoint = False
Dim myPPR As PromptPointResult = ed.GetPoint(myPPO)
Dim i As Integer = 0
Dim acPoly As Polyline = New Polyline()
acPoly.SetDatabaseDefaults()
While myPPR.Status = Autodesk.AutoCAD.EditorInput.PromptStatus.OK
myPPO.UseBasePoint = True
myPPO.BasePoint = myPPR.Value
myPPO.Message = "Pick next point: "
myPPR = ed.GetPoint(myPPO)
i = i + 1
End While
If i > 3 Then
acPoly.Closed = True
acBlkTblRec.AppendEntity(acPoly)
acTrans.AddNewlyCreatedDBObject(acPoly, True)
Dim myProfile As New Autodesk.Aec.Geometry.Profile
Autodesk.Aec.Geometry.Profile.CreateFromEntity(acPoly, Matrix3d.Identity)
Dim mySpace As Space = New Space
mySpace.SetDatabaseDefaults(db)
mySpace.SetToStandard(db)
mySpace.Associative = False
mySpace.GeometryType = SpaceGeometryType.TwoD
mySpace.Location = New Point3d(0, 0, 0)
mySpace.SetBaseProfile(myProfile, Matrix3d.Identity)
acBlkTblRec.AppendEntity(mySpace)
acTrans.AddNewlyCreatedDBObject(mySpace, True)
End If
acTrans.Commit()
End Using