marco_greven
asked on
.net Autodesk.Aec.Modeler.Body
Hello,
I am new to .Net programming in AutoCAD Architecture and going thru the samples from Autodesk.
In a sample they create a cone thru VB.NET.
I managed to alter the code to draw a 3D box with the following code:
Private Function CreateMassBox(ByVal InsPnt As Point3d, ByVal Afmeting3D As Vector3d) As ObjectId
' Functie om een 3D box te tekenen...
Dim db As Database = HostApplicationServices.Wo rkingDatab ase
Dim tm As Autodesk.AutoCAD.DatabaseS ervices.Tr ansactionM anager = db.TransactionManager
Dim id As ObjectId
Dim t As Transaction = tm.StartTransaction()
Try
Dim bt As BlockTable = tm.GetObject(db.BlockTable Id, OpenMode.ForRead, False)
Dim btr As BlockTableRecord = tm.GetObject(bt(BlockTable Record.Mod elSpace), OpenMode.ForWrite, False)
Dim temp As Autodesk.Aec.DatabaseServi ces.MassEl ement = Autodesk.Aec.DatabaseServi ces.MassEl ement.Crea te(ShapeTy pe.Boundar yRepresent ation)
Dim body As Autodesk.Aec.Modeler.Body = Autodesk.Aec.Modeler.Body. Box(InsPnt , Afmeting3D)
temp.SetDatabaseDefaults()
temp.SetBody(body, False)
id = btr.AppendEntity(temp)
tm.AddNewlyCreatedDBObject (temp, True)
t.Commit()
Finally
t.Dispose()
End Try
Return id
End Function
I also tried to create a 3D body of the "RightTriangle" type, but i can't figure out how to do this and i can't find any documentation or samples about this.
Can anyone help me with a sample?
Kind regards,
Marco
I am new to .Net programming in AutoCAD Architecture and going thru the samples from Autodesk.
In a sample they create a cone thru VB.NET.
I managed to alter the code to draw a 3D box with the following code:
Private Function CreateMassBox(ByVal InsPnt As Point3d, ByVal Afmeting3D As Vector3d) As ObjectId
' Functie om een 3D box te tekenen...
Dim db As Database = HostApplicationServices.Wo
Dim tm As Autodesk.AutoCAD.DatabaseS
Dim id As ObjectId
Dim t As Transaction = tm.StartTransaction()
Try
Dim bt As BlockTable = tm.GetObject(db.BlockTable
Dim btr As BlockTableRecord = tm.GetObject(bt(BlockTable
Dim temp As Autodesk.Aec.DatabaseServi
Dim body As Autodesk.Aec.Modeler.Body = Autodesk.Aec.Modeler.Body.
temp.SetDatabaseDefaults()
temp.SetBody(body, False)
id = btr.AppendEntity(temp)
tm.AddNewlyCreatedDBObject
t.Commit()
Finally
t.Dispose()
End Try
Return id
End Function
I also tried to create a 3D body of the "RightTriangle" type, but i can't figure out how to do this and i can't find any documentation or samples about this.
Can anyone help me with a sample?
Kind regards,
Marco
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://www.theswamp.org/