Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Moving VBA Application to c# - AutoCADEntity Array

I'm trying to bringt this VBA code to c#:

    Dim Segments(1 To 12) As AcadEntity
    Dim MP1
    Dim P1, P2
    '1. set center point MP1
    MP1 = ThisDrwaing.Utility.PolarPoint(EP, radians(90), D2half + radius)
    '2.  draw an arc with given Values and add it to Segments array position 1
    Set Segmente(1) = ThisDrawing.ModelSpace.AddArc(MP1, radius, radians(-90), radians(-halfOpeningAngle))
    '3. get the Start Point of the drawn arc stored in Segments 1
    P1 = Segmente(1).StartPoint
    '4. get the End Point of the drawn arc stored in Segments 1
    P2 = Segmente(1).EndPoint

How far I've come so far:

    //1. set center point MP1
    Point3d MP1 = new Point3d(0, 0, 0);
    MP1 = PolarPoint(öv_EP, radians(90), d2half + radius);

    //2.  draw an arc with given Values and add it to Segments array position 1
    //Create entity array for 12 entities first. I need this to be able to mirror all the 12 entities to draw the final structure.
    Teigha.DatabaseServices.Entity[] Segmente = new Entity[12];

    //store an arc in Segements[1]
    Segments[1] = new Arc(MP1, radius, radians(-90), radians(-halfOpeningAngle))
    //Draw the Arc
    using (Transaction action = manager.StartTransaction())
            {
                BlockTable blockTable = action.GetObject(database.BlockTableId, OpenMode.ForRead) as BlockTable;
                if (blockTable == null)
                    throw new System.NullReferenceException("blockTable == null");

                BlockTableRecord blockTableRecord = action.GetObject(blockTable[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
                if (blockTableRecord == null)
                    throw new System.NullReferenceException("blockTableRecord == null");


                blockTableRecord.AppendEntity(Segments[1]);
                action.AddNewlyCreatedDBObject(Segments[1], true);

    //3. After the arc is drawn, the entity should have a start and end point, right?

How can I now access the Startpoint of Segments[1] like I marked in the image ?

Bricscad Arc Properties.png
881 x 538 - 29K
Sign In or Register to comment.
Origami
Origami is the Japanese word for paper folding. ORI means to fold and KAMI means paper and involves the creation of paper forms usually entirely by folding.

Powered by VanillaForums, Designed by Steam