Multi-segment dynamic cutting closure area

Source: Internet
Author: User


#include "StdAfx.h"
#include "StdArx.h"
#include <dbpl.h>
#include ". \.. \common\others\convertutil.h "
#include ". \.. \common\document\dwgdatabaseutil.h "
#include <dbents.h>
#include <dbregion.h>
#include ". \.. \common\entity\regionutil.h "

This is command ' INTERSECT1 '
void ZffMyProjectintersect1 ()
{
Todo:implement the command
Ads_name Polylinename;
Ads_name polyLinename2;
Ads_point PNT;
Ads_point Pnt2;

Acdbpolyline *ppolyline=null;
Acdbpolyline *ppoly=null;
Acdbregion *pregion1=null;
Acdbregion *pregion2=null;
Acedentsel ("\ n choose to intercept polylines!", POLYLINENAME,PNT);
Acdbobjectid Polylineid;
Acdbgetobjectid (polylineid,polylinename);
Acdbentity *pent=null;
Acgepoint3darray pts,pts2;
Acdbopenobject (Pent,polylineid,acdb::kforwrite);

if (pent->iskindof (acdbpolyline::d ESC ()))
{
Ppolyline=acdbpolyline::cast (pent);
Pent->close ();
}
Acdbvoidptrarray curves;
int Num=ppolyline->numverts ();
for (int i=0;i<num;i++)
{
Acgepoint2d pt;
Ppolyline->getpointat (I,PT);
Pts.append (Cconvertutil::topoint3d (PT));
}
Ppolyline->getsplitcurves (pts,curves);
Ppolyline->close ();
Acdbobjectidarray Curvesid;
Acdbcurve *pcurve=null;
for (I=0;i<curves.length (); i++)
{
pcurve=static_cast<acdbcurve*> (curves[i]);
Curvesid.append (cdwgdatabaseutil::P osttomodelspace (Pcurve));
}
Pcurve->close ();

Acedentsel ("\ n Please select the intercepted polyline!", Polylinename2,pnt2);
Acdbgetobjectid (polylineid,polylinename2);
Acdbopenobject (Pent,polylineid,acdb::kforwrite);
if (Pent->iskindof (acdbpolyline::d ESC ()))
{
Ppoly=acdbpolyline::cast (pent);
Pent->close ();
Ppoly->intersectwith (ppolyline,acdb::konbothoperands,pts,0,0);
}
Acdbvoidptrarray Curves2;
Num=ppoly->numverts ();
for (i=0;i<num;i++)
{
ACGEPOINT2D pt2;
Ppoly->getpointat (I,PT2);
Pts2.append (Cconvertutil::topoint3d (pt2));
}
Ppoly->getsplitcurves (Pts2,curves2);
Ppoly->close ();
Acdbobjectidarray curvesId2;
Acdbcurve *pcurve2=null;
For (I=0;i<curves2.length (); i++)
{
Pcurve2=static_cast<acdbcurve*> (Curves2[i]);
Curvesid2.append (cdwgdatabaseutil::P osttomodelspace (pCurve2));
}
Pcurve2->close ();
Acdbobjectidarray Regid=cregionutil::add (CURVESID);
Acdbobjectidarray Regid2=cregionutil::add (CURVESID2);
For (I=0;i<curvesid.length (); i++)
{
Acdbopenobject (Pcurve,curvesid[i],acdb::kforwrite);
Pcurve->erase ();
Pcurve->close ();
}
For (I=0;i<curvesid2.length (); i++)
{
Acdbopenobject (Pcurve2,curvesid2[i],acdb::kforwrite);
Pcurve2->erase ();
Pcurve2->close ();
}
Acdbopenobject (Pregion1,regid[0],acdb::kforwrite);
Acdbopenobject (Pregion2,regid2[0],acdb::kforwrite);
Pregion1->booleanoper (Acdb::kboolintersect,pregion2);
Pregion1->close ();
Pregion2->close ();
}

Multi-segment dynamic cutting closure area

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.