ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Problem with ed.traceboundary

0 REPLIES 0
Reply
Message 1 of 1
Eslami.h10
439 Views, 0 Replies

Problem with ed.traceboundary

Hello., I am using objectarx 2012 in atocad 2011. When I use the ed. traceboundary by simultaneously zooming does not create the desired range.

 


            for (int i = 0; i < dtBeamsLoc.Rows.Count; i++)
            {
                using (DatabaseServices.Transaction tr = db.TransactionManager.StartTransaction())
                {
                    DatabaseServices.BlockTableRecord btr =
                        (DatabaseServices.BlockTableRecord)tr.GetObject(db.CurrentSpaceId, DatabaseServices.OpenMode.ForWrite);

                    string beamName = dtBeamsLoc.Rows[i].Field<string>("Beam");

                    Single beamWidth = dtBeamsLoc.Rows[i].Field<Single>("WidthTop");

                    Single x1 = dtBeamsLoc.Rows[i].Field<Single>("X1");
                    Single y1 = dtBeamsLoc.Rows[i].Field<Single>("Y1");
                    Single x2 = dtBeamsLoc.Rows[i].Field<Single>("X2");
                    Single y2 = dtBeamsLoc.Rows[i].Field<Single>("Y2");

                    DatabaseServices.Line lineBeam = new DatabaseServices.Line();
                    lineBeam.SetDatabaseDefaults();
                    lineBeam.Color = Autodesk.AutoCAD.Colors.Color.FromColor(System.Drawing.Color.Red);
                    lineBeam.StartPoint = new Geometry.Point3d(baseX_ + x1 / unitConvert_, baseY_ + y1 / unitConvert_, 0);
                    lineBeam.EndPoint = new Geometry.Point3d(baseX_ + x2 / unitConvert_, baseY_ + y2 / unitConvert_, 0);
                    
                    //btr.AppendEntity(lineBeam);
                    //tr.AddNewlyCreatedDBObject(lineBeam, true);

                    DatabaseServices.DBObjectCollection[] dbObjCollOffset = new DatabaseServices.DBObjectCollection[2];
                    dbObjCollOffset[0] = lineBeam.GetOffsetCurves(beamWidth / unitConvert_ / 2);
                    dbObjCollOffset[1] = lineBeam.GetOffsetCurves(-beamWidth / unitConvert_ / 2);

                    for (int k = 0; k < 2; k++)
                    {
                        btr.AppendEntity(dbObjCollOffset[k][0] as DatabaseServices.Entity);
                        tr.AddNewlyCreatedDBObject(dbObjCollOffset[k][0], true);
                    }

                    //lineBeam.Visible = false;

                    tr.Commit();
                    Autodesk.AutoCAD.Internal.Utils.FlushGraphics();
                }
            }

            DatabaseServices.DBObjectCollection ptsPolyLine = new DatabaseServices.DBObjectCollection();

            for (int j = 0; j < dtDeckJoistLoc.Rows.Count; j++)
            {
              
                        double centX = baseX_ + dtDeckJoistLoc.Rows[j].Field<Single>("CentroidX") / unitConvert_;
                        double centY = baseY_ + dtDeckJoistLoc.Rows[j].Field<Single>("CentroidY") / unitConvert_;

                        ptsPolyLine = ed.TraceBoundary(new Autodesk.AutoCAD.Geometry.Point3d(centX, centY, 0), true);

                        if (ptsPolyLine.Count > 0)
                        {
                            DatabaseServices.Polyline pl = ptsPolyLine[0] as DatabaseServices.Polyline;

                            using (DatabaseServices.Transaction tr = db.TransactionManager.StartTransaction())
                            {
                                DatabaseServices.BlockTableRecord btr =
                                    (DatabaseServices.BlockTableRecord)tr.GetObject(db.CurrentSpaceId, DatabaseServices.OpenMode.ForWrite);

                                btr.AppendEntity(pl);
                                tr.AddNewlyCreatedDBObject(pl, true);

                                tr.Commit();
                                Autodesk.AutoCAD.Internal.Utils.FlushGraphics();
                            }
                        }
            }

0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

”Boost