.net Autodesk.Aec.Modeler.Body

Posted on 2010-01-01
Last Modified: 2013-12-04

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.WorkingDatabase
        Dim tm As Autodesk.AutoCAD.DatabaseServices.TransactionManager = db.TransactionManager
        Dim id As ObjectId
        Dim t As Transaction = tm.StartTransaction()
            Dim bt As BlockTable = tm.GetObject(db.BlockTableId, OpenMode.ForRead, False)
            Dim btr As BlockTableRecord = tm.GetObject(bt(BlockTableRecord.ModelSpace), OpenMode.ForWrite, False)
            Dim temp As Autodesk.Aec.DatabaseServices.MassElement = Autodesk.Aec.DatabaseServices.MassElement.Create(ShapeType.BoundaryRepresentation)
            Dim body As Autodesk.Aec.Modeler.Body = Autodesk.Aec.Modeler.Body.Box(InsPnt, Afmeting3D)
            temp.SetBody(body, False)
            id = btr.AppendEntity(temp)
            tm.AddNewlyCreatedDBObject(temp, True)
        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,

Question by:marco_greven
    LVL 11

    Expert Comment

    You'll find a larger pool of Autodesk .Net programmers here that should be able to answer your question...

    Accepted Solution

    I found a sample of the code and will share it here:

                                    private ObjectId CreateMassTriangle()
                                                    Database db = HostApplicationServices.WorkingDatabase;
                                                    Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = db.TransactionManager;
                                                    ObjectId id = new ObjectId();
                                                    Transaction t = tm.StartTransaction();
                    BlockTable bt = tm.GetObject(db.BlockTableId, Autodesk.AutoCAD.DatabaseServices.OpenMode.ForRead, false) as BlockTable;
                    BlockTableRecord btr = tm.GetObject(bt[BlockTableRecord.ModelSpace], Autodesk.AutoCAD.DatabaseServices.OpenMode.ForWrite, false) as BlockTableRecord ;
                     MassElement massElem12 = MassElement.Create(ShapeType.RightTriangle);
                    massElem12.ColorIndex = 12;
                    massElem12.Location = new Point3d(60.0, 30.0, 0.0);
                    massElem12.Width = 40.0;
                    massElem12.Depth = 20.0;
                    massElem12.Height = 50.0;

                    id = btr.AppendEntity(massElem12);
                    tm.AddNewlyCreatedDBObject(massElem12, true);
                                    return id;




    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    In my previous two articles we discussed Binary Serialization ( and XML Serialization ( In this article we will try to know more about SOAP (Simple Object Acces…
    This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    This video discusses moving either the default database or any database to a new volume.

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now