hulei_accp 发表于 2005-11-7 22:57:00

<P>#include "adscodes.h"<BR>#include "rxregsvc.h"<BR>#include "assert.h"<BR>#include "math.h"<BR>#include "gepnt3d.h"<BR>#include "gevec3d.h"<BR>#include "gelnsg3d.h"<BR>#include "gearc3d.h"<BR>#include "dbents.h"<BR>#include "dbsymtb.h"<BR>#include "acgi.h"<BR>#include "acdb.h"<BR>#include "acdbabb.h"<BR>#include "aced.h"<BR>#include "acedads.h"<BR>#include "adesk.h"<BR>#include "dbapserv.h"<BR>#include "customEntity.h"</P>
<P><BR>Acad::ErrorStatus addToModelSpace(AcDbObjectId&amp; , AcDbEntity*);<BR>void elevDim();<BR>void initApp();<BR>void unloadApp();</P>
<P>extern "C" AcRx::AppRetCode acrxEntryPoint(AcRx::AppMsgCode msg, void * pkt);</P>
<P>static Acad::ErrorStatus drawDim(const CMyElevDim * elevDim,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AcGiWorldDraw * woldDraw,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AcGiViewportDraw * vportDraw);<BR>static Acad::ErrorStatus intLine(const CMyElevDim *&nbsp; elevDim,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const AcGeLine3d line,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AcGePoint3dArray &amp; points);<BR>static Acad::ErrorStatus intLine(const CMyElevDim * elevDim,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const AcGeLineSeg3d line,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AcDb::Intersect&nbsp; intType,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const AcGePlane * projPlane,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AcGePoint3dArray &amp; points);<BR>static Acad::ErrorStatus intArc(const CMyElevDim * elevDim,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const AcDbArc * arc,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AcDb::Intersect intType,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const AcGePlane * projPlane,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AcGePoint3dArray &amp; points);<BR>static Acad::ErrorStatus intArc(const CMyElevDim * elevDim,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const AcGeCircArc3d arc,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AcDb::Intersect intType,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const AcGePlane * projPlane,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AcGePoint3dArray &amp; points);</P>
<P>static Acad::ErrorStatus intCircle(const CMyElevDim *elevDim,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const AcDbCircle *circle,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AcDb::Intersect intType,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const AcGePlane * projPlane,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AcGePoint3dArray &amp; points);</P>
<P>static Acad::ErrorStatus intCircle(const CMyElevDim * elevDim,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const AcGeCircArc3d circle,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AcDb::Intersect intType,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const AcGePlane * projPlane,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AcGePoint3dArray &amp; points);<BR>ACRX_DXF_DEFINE_MEMBERS(CMyElevDim,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AcDbEntity,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AcDb::kDHL_CURRENT,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AcDb::kMReleaseCurrent,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CUSTOMENTITY,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AUTOCAD);<BR>CMyElevDim::CMYElevDim()<BR>{<BR>&nbsp;assertWriteEnabled();<BR>&nbsp;mStartPoint.set(0,0,0);<BR>&nbsp;mInsertPoint.set(0,0,0);<BR>&nbsp;mSymbolPoint.set(0,0,0);<BR>&nbsp;mHeight=0;<BR>&nbsp;mLength=0;<BR>&nbsp;mElevation=0;<BR>}<BR>CMyElevDim::~CMyElevDim()<BR>{}</P>
<P>Acad::ErrorStatus<BR>CMyElevDim::getVertices3d(AcGePoint3dArray &amp; vertexArray) const<BR>{<BR>&nbsp;assertReadEnabled();<BR>&nbsp;AcGePoint3dArray temparray;<BR>&nbsp;AcGePoint3d tempPoint;<BR>&nbsp;double height=getHeight();<BR>&nbsp;double length=getLength();<BR>&nbsp;vertexArray.append(mStartPoint);<BR>&nbsp;tempPoint=mStartPoint+AcGeVector3d(length,0,0);<BR>&nbsp;vertexArray.append(tempPoint);<BR>&nbsp;vertexArray.append(mSymbolPoint);<BR>&nbsp;tempPoint.set(mSymbolPoint.x-0.5*height,mSymbolPoint.y+height,mSymbolPoint.z);<BR>&nbsp;vertexArray.append(tempPoint);<BR>&nbsp;tempPoint.set(mSymbolPoint.x+0.5*height,mSymbolPoint.y+height,mSymbolPoint.z);<BR>&nbsp;vertexArray.append(tempPoint);<BR>&nbsp;return Acad::eOk;<BR>}</P>
<P>Acad::ErrorStatus<BR>CMyElevDim::getOsnapPoints(AcDb::OsnapMode&nbsp;&nbsp;osnapMode,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gsSelectionMark,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const AcGePoint3d&amp;&nbsp;pickPoint,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const AcGePoint3d&amp;&nbsp; lastPoint,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const AcGeMatrix3d&amp;&nbsp;viewXform,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AcGePoint3dArray &amp;&nbsp;snapPoints,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AcDbIntArray &amp;&nbsp;&nbsp;&nbsp; )const<BR>{<BR>&nbsp;assertReadEnabled();<BR>&nbsp;Acad::ErrorStatus es=Acad::eOk;<BR>&nbsp;if(gsSelectionMark==0)<BR>&nbsp;{<BR>&nbsp;&nbsp;return Acad::eOk;<BR>&nbsp;}<BR>&nbsp;if(osnapMode!=AcDb::kOsModeEnd <BR>&nbsp;&nbsp;&amp;&amp; osnapMode!=AcDb::kOsModeMid<BR>&nbsp;&nbsp;&amp;&amp; osnapMode!=AcDb::kOsModeNear<BR>&nbsp;&nbsp;&amp;&amp; osnapMode!=AcDb::kOsModePerp<BR>&nbsp;&nbsp;&amp;&amp; osnapMode!=AcDb::kOsModeIns)<BR>&nbsp;{<BR>&nbsp;&nbsp;return Acad::eOk;<BR>&nbsp;}</P>
<P>&nbsp;AcGePoint3d startPoint;<BR>&nbsp;if(gsSelectionMark==5)<BR>&nbsp;{<BR>&nbsp;&nbsp;if(osnapMode==AcDb::kOsModeIns)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;snapPoints.append(mInsertPoint);<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;return es;<BR>&nbsp;}<BR>&nbsp;int startIndex;<BR>&nbsp;if(gsSelectionMark==1)<BR>&nbsp;{<BR>&nbsp;&nbsp;startIndex=gsSelectionMark-1;<BR>&nbsp;}<BR>&nbsp;else<BR>&nbsp;{<BR>&nbsp;&nbsp;startIndex=gsSelectionMark;<BR>&nbsp;}<BR>&nbsp;AcGePoint3dArray vertexArray;<BR>&nbsp;if((es=getVertices3d(vertexArray))!=Acad::eOk)<BR>&nbsp;{<BR>&nbsp;&nbsp;return es;<BR>&nbsp;}<BR>&nbsp;AcGeLineSeg3d lnsg;<BR>&nbsp;if(startIndex==4)<BR>&nbsp;{<BR>&nbsp;&nbsp;lnsg=AcGeLineSeg3d(vertexArray,vertexArray);<BR>&nbsp;}<BR>&nbsp;else<BR>&nbsp;{<BR>&nbsp;&nbsp;lnsg=AcGeLineSeg3d(vertexArray,vertexArray);<BR>&nbsp;}<BR>&nbsp;AcGePoint3d pt;<BR>&nbsp;AcGeLine3d line,perpLine;<BR>&nbsp;AcGeVector3d vec;<BR>&nbsp;AcGeVector3d viewDir(viewXform(Z,0),viewXform(Z,1),viewXform(Z,2));<BR>&nbsp;switch(osnapMode)<BR>&nbsp;{<BR>&nbsp;&nbsp;case AcDb::kOsModeEnd:<BR>&nbsp;&nbsp;&nbsp;snapPoints.append(lnsg.startPoint());<BR>&nbsp;&nbsp;&nbsp;snapPoints.append(lnsg.endPoint());<BR>&nbsp;&nbsp;&nbsp;break;<BR>&nbsp;&nbsp;case AcDb::kOsModeMid:<BR>&nbsp;&nbsp;&nbsp;pt.set(((lnsg.startPoint())+(lnsg.endPoint()))*0.5,<BR>&nbsp;&nbsp;&nbsp;&nbsp;((lnsg.startPoint())+(lnsg.endPoint()))*0.5,<BR>&nbsp;&nbsp;&nbsp;&nbsp;((lnsg.startPoint())+(lnsg.endPoint()))*0.5);<BR>&nbsp;&nbsp;&nbsp;&nbsp;snapPoints.append(pt);<BR>&nbsp;&nbsp;&nbsp;break;<BR>&nbsp;&nbsp;case AcDb::kOsModeNear:<BR>&nbsp;&nbsp;&nbsp;pt=lnsg.projClosestPointTo(pickPoint,viewDir);<BR>&nbsp;&nbsp;&nbsp;snapPoints.append(pt);<BR>&nbsp;&nbsp;&nbsp;break;<BR>&nbsp;&nbsp;case AcDb::kOsModePerp:<BR>&nbsp;&nbsp;&nbsp;vec=lnsg.endPoint()-lnsg.startPoint();<BR>&nbsp;&nbsp;&nbsp;vec.normalize();<BR>&nbsp;&nbsp;&nbsp;line.set(lnsg.startPoint(),vec);<BR>&nbsp;&nbsp;&nbsp;pt=line.closestPointTo(lastPoint);<BR>&nbsp;&nbsp;&nbsp;snapPoints.append(pt);<BR>&nbsp;&nbsp;&nbsp;break;<BR>&nbsp;&nbsp;default:<BR>&nbsp;&nbsp;&nbsp;return Acad::eOk;<BR>&nbsp;}<BR>&nbsp;return es;</P>
<P>}</P>
<P>Acad::ErrorStatus<BR>CMyElevDim::getGripPoints(AcGePoint3dArray &amp; gripPoints,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AcDbIntArray&amp; osnapModes,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AcDbIntArray&amp; geomIds) const<BR>{<BR>&nbsp;assertReadEnabled();<BR>&nbsp;Acad::ErrorStatus es;<BR>&nbsp;if((es=getVertices3d(gripPoints))!=Acad::eOk)<BR>&nbsp;{<BR>&nbsp;&nbsp;return es;<BR>&nbsp;}<BR>&nbsp;gripPoints.append(mInsertPoint);<BR>&nbsp;return es;<BR>}<BR>Acad::ErrorStatus<BR>CMyElevDim::moveGripPointsAt(const AcDbIntArray&amp; indices,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const AcGeVector3d&amp; offset)<BR>{<BR>&nbsp;if(indices.length()==0||offset.isZeroLength())<BR>&nbsp;{<BR>&nbsp;&nbsp;return transformBy(AcGeMatrix3d::translation(offset));<BR>&nbsp;}<BR>&nbsp;AcGeVector3d off(offset);<BR>&nbsp;double dist;<BR>&nbsp;switch(indices)<BR>&nbsp;{<BR>&nbsp;case 1:<BR>&nbsp;&nbsp;mLength+=off.x;<BR>&nbsp;&nbsp;if(mLength&lt;40.0)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;mLength=40.0;<BR>&nbsp;&nbsp;}&nbsp;&nbsp;<BR>&nbsp;&nbsp;break;<BR>&nbsp;case 2:<BR>&nbsp;&nbsp;mSymbolPoint+=off;<BR>&nbsp;&nbsp;dist=mSymbolPoint.x-mStartPoint.x;<BR>&nbsp;&nbsp;if(dist&lt;0)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;mSymbolPoint.x=mStartPoint.x;<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;else if(dist&gt;mLength)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;mSymbolPoint.x=mStartPoint.x+mLength;<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;mSymbolPoint.y=mStartPoint.y;<BR>&nbsp;&nbsp;mSymbolPoint.z=mStartPoint.z;<BR>&nbsp;&nbsp;break;<BR>&nbsp;case 3:<BR>&nbsp;case 4:<BR>&nbsp;&nbsp;mHeight+=off.y;<BR>&nbsp;&nbsp;if(mHeight&lt;10.0)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;mHeight=10.0;<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;break;<BR>&nbsp;case 5:<BR>&nbsp;&nbsp;mInsertPoint+=off;<BR>&nbsp;&nbsp;if(((mInsertPoint.x=mSymbolPoint.x)&lt;mHeight)||((mInsertPoint.y-mSymbolPoint.y)&lt;0.2*mHeight))<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;mInsertPoint.x=mSymbolPoint.x+mHeight;<BR>&nbsp;&nbsp;&nbsp;mInsertPoint.y=mSymbolPoint.y+0.2*mHeight;<BR>&nbsp;&nbsp;&nbsp;mInsertPoint.z=mSymbolPoint.z;<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;break;<BR>&nbsp;}<BR>&nbsp;return Acad::eOk;<BR>}</P>
<P>Acad::ErrorStatus<BR>CMyElevDim::getStretchPoints(AcGePoint3dArray &amp; stretchPoints) const<BR>{<BR>&nbsp;assertReadEnabled();<BR>&nbsp;Acad::ErrorStatus es;<BR>&nbsp;if((es=getVertices3d(stretchPoints))!=Acad::eOk)<BR>&nbsp;{<BR>&nbsp;&nbsp;return es;<BR>&nbsp;}<BR>&nbsp;stretchPoints.removeAt(stretchPoints.length()-1);<BR>&nbsp;return es;<BR>}</P>
<P>Acad::ErrorStatus<BR>CMyElevDim::moveStretchPointsAt(const AcDbIntArray &amp; indices,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const AcGeVector3d&amp; offset)<BR>{<BR>&nbsp;return moveGripPointsAt(indices,offset);<BR>}<BR>Acad::ErrorStatus<BR>CMyElevDim::getTransformerdCopy(const AcGeMatrix3d&amp; mat,AcDbEntity * &amp;ent)const<BR>{<BR>&nbsp;assertReadEnabled();<BR>&nbsp;Acad::ErrorStatus es=Acad::eOk;<BR>&nbsp;AcGePoint3dArray vertexArray;<BR>&nbsp;if((es=getVertices3d(vertexArray))!=Acad::eOk)<BR>&nbsp;{<BR>&nbsp;&nbsp;return es;<BR>&nbsp;}<BR>&nbsp;for(int i=0; i&lt;vertexArray.length()-1;i++)<BR>&nbsp;{<BR>&nbsp;&nbsp;vertexArray.transformBy(mat);<BR>&nbsp;}<BR>&nbsp;AcGePoint3dArray tempPtArray;<BR>&nbsp;tempPtArray.append(vertexArray);<BR>&nbsp;tempPtArray.append(vertexArray);<BR>&nbsp;tempPtArray.append(vertexArray);<BR>&nbsp;tempPtArray.append(vertexArray);<BR>&nbsp;tempPtArray.append(vertexArray);<BR>&nbsp;AcDb2dPolyline *pPolyline;<BR>&nbsp;pPolyline=new AcDb2dPolyline(k2dSimplePoly,vertexArray);<BR>&nbsp;assert(pPolyline!=NULL);<BR>&nbsp;pPolyline-&gt;setPropertiesFrom(this);<BR>&nbsp;ent=pPolyline;<BR>&nbsp;return es;</P>
<P>}</P>
<P>Acad::ErrorStatus<BR>CMyElevDim::transformBy(const AcGeMatrix3d&amp; xform)<BR>{<BR>&nbsp;assertWriteEnabled();<BR>&nbsp;mStartPoint.transformBy(xform);<BR>&nbsp;mSymbolPoint.transformBy(xform);<BR>&nbsp;mInsertPoint.transformBy(xform);<BR>&nbsp;mHeight=mHeight*xform.scale();<BR>&nbsp;mLength=mLength*xform.scale();<BR>&nbsp;mElevation=mStartPoint.y;<BR>&nbsp;return Acad::eOk;<BR>}<BR>Acad::ErrorStatus<BR>CMyElevDim::intersectWith(const AcDbEntity * ent,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AcDb::Intersect intType,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AcGePoint3dArray &amp;points,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int)const<BR>{<BR>&nbsp;assertReadEnabled();<BR>&nbsp;Acad::ErrorStatus es=Acad::eOk;<BR>&nbsp;if(ent==NULL)<BR>&nbsp;{<BR>&nbsp;&nbsp;return Acad::eNullEntityPointer;<BR>&nbsp;}<BR>&nbsp;if(ent-&gt;isKindOf(AcDbLine::desc()))<BR>&nbsp;{<BR>&nbsp;&nbsp;if((es=intLine(this,AcDbLine::cast(ent),<BR>&nbsp;&nbsp;&nbsp;intType,NULL,points))!=Acad::eOk)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;return es;<BR>&nbsp;&nbsp;}<BR>&nbsp;}<BR>&nbsp;else if(ent-&gt;isKindOf(AcDbArc::desc()))<BR>&nbsp;{<BR>&nbsp;&nbsp;if((es=intArc(this,AcDbArc::cast(ent),intType,<BR>&nbsp;&nbsp;&nbsp;NULL,points))!=Acad::eOk)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;return es;<BR>&nbsp;&nbsp;}<BR>&nbsp;}<BR>&nbsp;else if(ent-&gt;isKindOf(AcDbCircle::desc()))<BR>&nbsp;{<BR>&nbsp;&nbsp;if((es=intCircle(this,AcDbCircle::cast(ent),<BR>&nbsp;&nbsp;&nbsp;intType,NULL,points))!=Acad::eOk)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;return es;<BR>&nbsp;&nbsp;}<BR>&nbsp;}<BR>&nbsp;else<BR>&nbsp;{<BR>&nbsp;&nbsp;AcGePoint3dArray vertexArray;<BR>&nbsp;&nbsp;if((es=getVertices3d(vertexArray))!=Acad::eOk)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;return es;<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;if(intType==AcDb::kExtendArg||intType==AcDb::kExtendBoth)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;intType=AcDb::kExtendThis;<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;AcDbLine * pAcadLine;<BR>&nbsp;&nbsp;for(int i=0; i&lt;vertexArray.length()-1;i++)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;pAcadLine=new AcDbLine();<BR>&nbsp;&nbsp;&nbsp;if(i==1)<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;pAcadLine-&gt;setStartPoint(vertexArray);<BR>&nbsp;&nbsp;&nbsp;&nbsp;pAcadLine-&gt;setEndPoint(vertexArray);<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;pAcadLine-&gt;setStartPoint(vertexArray);<BR>&nbsp;&nbsp;&nbsp;&nbsp;pAcadLine-&gt;setEndPoint(vertexArray);<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;pAcadLine-&gt;setNormal(AcGeVector3d(0,0,1));<BR>&nbsp;&nbsp;&nbsp;if((es=ent-&gt;intersectWith(pAcadLine,intType,points))!=Acad::eOk)<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;delete pAcadLine;<BR>&nbsp;&nbsp;&nbsp;&nbsp;return es;<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;delete pAcadLine;<BR>&nbsp;&nbsp;}<BR>&nbsp;}<BR>&nbsp;return es;<BR>}</P>
<P>Acad::ErrorStatus<BR>CMyElevDim::intersectWith(const AcDbEntity * ent,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AcDb::Intersect intType,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const AcGePlane &amp; projPlane,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AcGePoint3dArray &amp; points,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int) const<BR>{<BR>&nbsp;assertReadEnabled();<BR>&nbsp;Acad::ErrorStatus es=Acad::eOk;<BR>&nbsp;if(ent=NULL)<BR>&nbsp;{<BR>&nbsp;&nbsp;return Acad::eNullEntityPointer;<BR>&nbsp;}<BR>&nbsp;if(ent-&gt;isKindOf(AcDbLine::desc()))<BR>&nbsp;{<BR>&nbsp;&nbsp;if((es=intLine(this,AcDbLine::cast(ent),<BR>&nbsp;&nbsp;&nbsp;intType,&amp;projPlane,points))!=Acad::eOk)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;return es;<BR>&nbsp;&nbsp;}<BR>&nbsp;}<BR>&nbsp;else if(ent-&gt;isKindOf(AcDbArc::desc()))<BR>&nbsp;{<BR>&nbsp;&nbsp;if((es=intArc(this,AcDbArc::cast(ent),<BR>&nbsp;&nbsp;&nbsp;intType,&amp;projPlane,points))!=Acad::eOk)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;return es;<BR>&nbsp;&nbsp;}<BR>&nbsp;}<BR>&nbsp;else if(ent-&gt;isKindOf(AcDbCircle::desc()))<BR>&nbsp;{<BR>&nbsp;&nbsp;if((es=intCircle(this,AcDbCircle::cast(ent),<BR>&nbsp;&nbsp;&nbsp;intType,&amp;projPlane,points))!=Acad::eOk)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;return es;<BR>&nbsp;&nbsp;}<BR>&nbsp;}<BR>&nbsp;else<BR>&nbsp;{<BR>&nbsp;&nbsp;AcGePoint3dArray vertexArray;<BR>&nbsp;&nbsp;if((es=getVertices3d(vertexArray))!=Acad::eOk)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;return es;<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;if(intType==AcDb::kExtendArg||intType==AcDb::kExtendBoth)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;intType=AcDb::kExtendThis;<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;AcDbLine *pLine;<BR>&nbsp;&nbsp;for(int i=0; i&lt;vertexArray.length()-1; i++)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;pLine=new AcDbLine();<BR>&nbsp;&nbsp;&nbsp;if(i==1)<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;pLine-&gt;setStartPoint(vertexArray);<BR>&nbsp;&nbsp;&nbsp;&nbsp;pLine-&gt;setEndPoint(vertexArray);<BR>&nbsp;&nbsp;&nbsp;&nbsp;pLine-&gt;setNormal(AcGeVector3d(0,0,1));<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;pLine-&gt;setStartPoint(vertexArray);<BR>&nbsp;&nbsp;&nbsp;&nbsp;pLine-&gt;setEndPoint(vertexArray);<BR>&nbsp;&nbsp;&nbsp;&nbsp;pLine-&gt;setNormal(AcGeVector3d(0,0,1));<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;if((es=ent-&gt;intersectWith(pLine,intType,<BR>&nbsp;&nbsp;&nbsp;&nbsp;projPlane,points))!=Acad::eOk)<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;delete pLine;<BR>&nbsp;&nbsp;&nbsp;&nbsp;return es;<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;delete pLine;<BR>&nbsp;&nbsp;}<BR>&nbsp;}<BR>&nbsp;return es;<BR>}</P>
<P>void CMyElevDim::list() const<BR>{<BR>&nbsp;assertReadEnabled();<BR>&nbsp;AcDbEntity::list();<BR>&nbsp;acutPrintf("%18s%16s%-9.16q0\n",<BR>&nbsp;&nbsp;"Elevation:",mElevation);<BR>&nbsp;AcGePoint3d sp=getStartPoint();<BR>&nbsp;acutPrintf("%18s%16s","","Start Point:");<BR>&nbsp;acutPrintf("x=%-9.16q0,y=%-9.16q0,z=%-9.16q0\n",<BR>&nbsp;&nbsp;sp.x,sp.y,sp.z);<BR>}</P>
<P>Acad::ErrorStatus<BR>CMyElevDim::explode(AcDbVoidPtrArray &amp; entitySet) const<BR>{<BR>&nbsp;assertReadEnabled();<BR>&nbsp;Acad::ErrorStatus es=Acad::eOk;<BR>&nbsp;AcGePoint3dArray vertexArray;<BR>&nbsp;if((es=getVertices3d(vertexArray))!=Acad::eOk)<BR>&nbsp;{<BR>&nbsp;&nbsp;return es;<BR>&nbsp;}<BR>&nbsp;AcDbLine * line;<BR>&nbsp;for(int i=0; i&lt;vertexArray.length()-1; i++)<BR>&nbsp;{<BR>&nbsp;&nbsp;line=new AcDbLine();<BR>&nbsp;&nbsp;if(i==1)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;line-&gt;setStartPoint(vertexArray);<BR>&nbsp;&nbsp;&nbsp;line-&gt;setEndPoint(vertexArray);<BR>&nbsp;&nbsp;&nbsp;line-&gt;setNormal(AcGeVector3d(0,0,1));<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;else<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;line-&gt;setStartPoint(vertexArray);<BR>&nbsp;&nbsp;&nbsp;line-&gt;setEndPoint(vertexArray);<BR>&nbsp;&nbsp;&nbsp;line-&gt;setNormal(AcGeVector3d(0,0,1));</P>
<P>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;entitySet.append(line);<BR>&nbsp;}<BR>&nbsp;AcDbText *pText;<BR>&nbsp;double elev;<BR>&nbsp;char str;<BR>&nbsp;elev=this-&gt;getElevation();<BR>&nbsp;acdbRToS(elev,2,2,str);<BR>&nbsp;pText=new AcDbText(mInsertPoint,str,AcDbObjectId::kNull,mHeight,0);<BR>&nbsp;entitySet.append(pText);<BR>&nbsp;return es;<BR>}<BR>Adesk::Boolean<BR>CMyElevDim::worldDraw(AcGiWorldDraw * worldDraw)<BR>{<BR>&nbsp;assertReadEnabled();<BR>&nbsp;if(worldDraw-&gt;regenAbort())<BR>&nbsp;{<BR>&nbsp;&nbsp;return Adesk::kTrue;<BR>&nbsp;}<BR>&nbsp;switch(worldDraw-&gt;regenType())<BR>&nbsp;{<BR>&nbsp;case kAcGiHideOrShadeCommand:<BR>&nbsp;case kAcGiRenderCommand:<BR>&nbsp;&nbsp;break;<BR>&nbsp;case kAcGiStandardDisplay:<BR>&nbsp;case kAcGiSaveWorldDrawForR12:<BR>&nbsp;case kAcGiSaveWorldDrawForProxy:<BR>&nbsp;&nbsp;AOK(drawDim(this,worldDraw,NULL));<BR>&nbsp;&nbsp;break;<BR>&nbsp;default:<BR>&nbsp;&nbsp;assert(Adesk::kFalse);<BR>&nbsp;}<BR>&nbsp;return Adesk::kTrue;<BR>}</P>
<P>Acad::ErrorStatus<BR>CMyElevDim::dwgInFields(AcDbDwgFiler * filer)<BR>{<BR>&nbsp;assertWriteEnabled();<BR>&nbsp;Acad::ErrorStatus es;<BR>&nbsp;if((es=AcDbEntity::dwgInFields(filer))!=Acad::eOk)<BR>&nbsp;{<BR>&nbsp;&nbsp;return es;<BR>&nbsp;}<BR>&nbsp;AcGePoint3d startPoint,symPoint,insPoint;<BR>&nbsp;filer-&gt;readPoint3d(&amp;startPoint);<BR>&nbsp;filer-&gt;readPoint3d(&amp;symPoint);<BR>&nbsp;filer-&gt;readPoint3d(&amp;insPoint);<BR>&nbsp;filer-&gt;readDouble(&amp;mHeight);<BR>&nbsp;filer-&gt;readDouble(&amp;mLength);<BR>&nbsp;filer-&gt;readDouble(&amp;mElevation);<BR>&nbsp;acdbWcs2Ecs(asDblArray(startPoint),asDblArray(startPoint),<BR>&nbsp;&nbsp;asDblArray(AcGeVector3d(0,0,1)),Adesk::kFalse);<BR>&nbsp;mStartPoint.set(startPoint.x,startPoint.y,startPoint.z);<BR>&nbsp;acdbWcs2Ecs(asDblArray(symPoint),asDblArray(symPoint),<BR>&nbsp;&nbsp;asDblArray(AcGeVector3d(0,0,1)),Adesk::kFalse);<BR>&nbsp;mSymbolPoint.set(symPoint.x,symPoint.y,symPoint.z);<BR>&nbsp;acdbWcs2Ecs(asDblArray(insPoint),asDblArray(insPoint),<BR>&nbsp;&nbsp;asDblArray(AcGeVector3d(0,0,1)),Adesk::kFalse);<BR>&nbsp;mInsertPoint.set(insPoint.x,insPoint.y,insPoint.z);<BR>&nbsp;return filer-&gt;filerStatus();<BR>}</P>
<P>Acad::ErrorStatus<BR>CMyElevDim::dwgOutFields(AcDbDwgFiler * filer) const<BR>{<BR>&nbsp;assertReadEnabled();<BR>&nbsp;Acad::ErrorStatus es;<BR>&nbsp;if((es=AcDbEntity::dwgOutFields(filer))!=Acad::eOk)<BR>&nbsp;{<BR>&nbsp;&nbsp;return es;<BR>&nbsp;}<BR>&nbsp;filer-&gt;writePoint3d(mStartPoint);<BR>&nbsp;filer-&gt;writePoint3d(mSymbolPoint);<BR>&nbsp;filer-&gt;writePoint3d(mInsertPoint);<BR>&nbsp;filer-&gt;writeDouble(mHeight);<BR>&nbsp;filer-&gt;writeDouble(mLength);<BR>&nbsp;filer-&gt;writeDouble(mElevation);<BR>&nbsp;return filer-&gt;filerStatus();<BR>}<BR>#ifdef ORDER_DEPENDENT<BR>Acad::ErrorStatus<BR>CMyElevDim::dxfInFields(AcDbDxfFiler * filer)<BR>{<BR>&nbsp;assertWriteEnabled();<BR>&nbsp;if((AcDbEntity::dxfInFields(filer)!=Acad::eOk)||!filer-&gt;atSubClassData("CMyElevDim"))<BR>&nbsp;{<BR>&nbsp;&nbsp;return filer-&gt;filerStatus();<BR>&nbsp;}<BR>&nbsp;try<BR>&nbsp;{<BR>&nbsp;&nbsp;AcGePoint3d sp,sympt,inspt;<BR>&nbsp;&nbsp;filer-&gt;readItem(&amp;rb);<BR>&nbsp;&nbsp;if(rb.restype!=AcDb::kDxfXCoord)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;throw AcDb::kDxfXCoord;<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;sp=asPnt3d(rb.resva.rpoint);<BR>&nbsp;&nbsp;filer-&gt;readItem(&amp;rb);<BR>&nbsp;&nbsp;if(rb.restype!=AcDb::kDxfXCoord+1)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;throw AcDb::kDxfXCoord+1;<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;sympt=asPnt3d(re.resval.rpoint);<BR>&nbsp;&nbsp;filer-&gt;readItem(&amp;rb);<BR>&nbsp;&nbsp;if(rb.restype!=AcDb::kDxfXCoord+2)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;throw AcDb::kDxfXCoord+2;<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;inspt=asPnt3d(rb.resval.rpoint);<BR>&nbsp;&nbsp;filer-&gt;readItem(&amp;rb);<BR>&nbsp;&nbsp;if(rb.restype!=AcDb::kDxfReal)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;thrwo AcDb::kDxfReal;<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;mHeight=rb.resval.rreal;<BR>&nbsp;&nbsp;filer-&gt;readItem(&amp;rb);<BR>&nbsp;&nbsp;if(rb.restype!=AcDb::kDxfReal+1)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;throw AcDb::kDxfReal+1;<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;mLength=rb.resva.rreal;<BR>&nbsp;&nbsp;filer-&gt;realItem(&amp;rb);<BR>&nbsp;&nbsp;if(rb.restype!=AcDb::kDxfReal+2)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;throw AcDb::kDxfReal+2;<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;mElevation=rb.resval.rreal;<BR>&nbsp;&nbsp;acDbWcs2Ecs(asDblArray(sp),asDblArray(sp),<BR>&nbsp;&nbsp;&nbsp;asDblArray(AcGeVector3d(0,0,1)),Adesk::kFalse);<BR>&nbsp;&nbsp;mStartPoint.set(sp.x,sp.y,sp.z);<BR>&nbsp;&nbsp;acdbWcs2Ecs(asDblArray(sympt),asDblArray(sympt),<BR>&nbsp;&nbsp;&nbsp;asDblArray(AcGeVector3d(0,0,1)),Adesk::kFalse);<BR>&nbsp;&nbsp;mSymbolPoint.set(sympt.x,sympt.y,sympt.z);<BR>&nbsp;&nbsp;acdbWcs2Ecs(asDblArray(inspt),asDblArray(inspt),<BR>&nbsp;&nbsp;&nbsp;asDblArray(AcGeVector3d(0,0,,1)),Adesk::kFalse);<BR>&nbsp;&nbsp;mInsertPoint.set(inspt.x,inspt.y,intpt.z);<BR>&nbsp;}<BR>&nbsp;catch(AcDb::DxfCode code)<BR>&nbsp;{<BR>&nbsp;&nbsp;filer-&gt;pushBackItem();<BR>&nbsp;&nbsp;filer-&gt;setError(Acad::EInvalidDxfCode,"\nError:expected group code %d",code);<BR>&nbsp;&nbsp;return filer-&gt;filerStatus();<BR>&nbsp;}<BR>}<BR>#else<BR>Acad::ErrorStatus<BR>CMyElevDim::dxfInFields(AcDbDxfFiler * filer)<BR>{<BR>&nbsp;assertWriteEnabled();<BR>&nbsp;Acad::ErrorStatus es=Acad::eOk;<BR>&nbsp;resbuf rb;<BR>&nbsp;if((AcDbEntity::dxfInFields(filer)!=Acad::eOk)||!filer-&gt;atSubclassData("CMyElevDim"))<BR>&nbsp;{<BR>&nbsp;&nbsp;return filer-&gt;filerStatus();<BR>&nbsp;}<BR>&nbsp;AcGePoint3d sp,sympt,inspt;<BR>&nbsp;Adesk::UInt32 fieldsFlags=0;<BR>&nbsp;while((es==Acad::eOk) &amp;&amp; ((es=filer-&gt;readResBuf(&amp;rb))==Acad::eOk))<BR>&nbsp;{<BR>&nbsp;&nbsp;switch(rb.restype)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;case AcDb::kDxfXCoord:<BR>&nbsp;&nbsp;&nbsp;sp=asPnt3d(rb.resval.rpoint);<BR>&nbsp;&nbsp;&nbsp;fieldsFlags=0x1;<BR>&nbsp;&nbsp;&nbsp;break;<BR>&nbsp;&nbsp;case AcDb::kDxfXCoord+1:<BR>&nbsp;&nbsp;&nbsp;sympt=asPnt3d(rb.resval.rpoint);<BR>&nbsp;&nbsp;&nbsp;fieldsFlags=0x2;<BR>&nbsp;&nbsp;&nbsp;break;<BR>&nbsp;&nbsp;case AcDb::kDxfXCoord+2:<BR>&nbsp;&nbsp;&nbsp;inspt=asPnt3d(rb.resval.rpoint);<BR>&nbsp;&nbsp;&nbsp;fieldsFlags=0x3;<BR>&nbsp;&nbsp;&nbsp;break;<BR>&nbsp;&nbsp;case AcDb::kDxfReal:<BR>&nbsp;&nbsp;&nbsp;mHeight=rb.resval.rreal;<BR>&nbsp;&nbsp;&nbsp;fieldsFlags=0x4;<BR>&nbsp;&nbsp;&nbsp;break;<BR>&nbsp;&nbsp;case AcDb::kDxfReal+1:<BR>&nbsp;&nbsp;&nbsp;mLength=rb.resval.rreal;<BR>&nbsp;&nbsp;&nbsp;fieldsFlags=0x5;<BR>&nbsp;&nbsp;&nbsp;break;<BR>&nbsp;&nbsp;case AcDb::kDxfReal+2:<BR>&nbsp;&nbsp;&nbsp;mElevation=rb.resval.rreal;<BR>&nbsp;&nbsp;&nbsp;fieldsFlags=0x6;<BR>&nbsp;&nbsp;&nbsp;break;<BR>&nbsp;&nbsp;default:<BR>&nbsp;&nbsp;&nbsp;filer-&gt;pushBackItem();<BR>&nbsp;&nbsp;&nbsp;es=Acad::eEndOfFile;<BR>&nbsp;&nbsp;&nbsp;break;<BR>&nbsp;&nbsp;}<BR>&nbsp;}<BR>&nbsp;if(es!=Acad::eEndOfFile)<BR>&nbsp;{<BR>&nbsp;&nbsp;return Acad::eInvalidResBuf;<BR>&nbsp;}<BR>&nbsp;acdbWcs2Ecs(asDblArray(sp),asDblArray(sp),<BR>&nbsp;&nbsp;asDblArray(AcGeVector3d(0,0,1)),Adesk::kFalse);<BR>&nbsp;mStartPoint.set(sp.x,sp.y,sp.z);<BR>&nbsp;acdbWcs2Ecs(asDblArray(sympt),asDblArray(sympt),<BR>&nbsp;&nbsp;asDblArray(AcGeVector3d(0,0,1)),Adesk::kFalse);<BR>&nbsp;mSymbolPoint.set(sympt.x,sympt.y,sympt.z);<BR>&nbsp;acdbWcs2Ecs(asDblArray(inspt),asDblArray(inspt),<BR>&nbsp;&nbsp;asDblArray(AcGeVector3d(0,0,1)),Adesk::kFalse);<BR>&nbsp;mInsertPoint.set(inspt.x,inspt.y,inspt.z);<BR>&nbsp;return es;<BR>}<BR>#endif<BR>Acad::ErrorStatus<BR>CMyElevDim::dxfOutFields(AcDbDxfFiler * filer) const<BR>{<BR>&nbsp;assertReadEnabled();<BR>&nbsp;Acad::ErrorStatus es;<BR>&nbsp;if((es=AcDbEntity::dxfOutFields(filer))!=Acad::eOk)<BR>&nbsp;{<BR>&nbsp;&nbsp;return es;<BR>&nbsp;}<BR>&nbsp;filer-&gt;writeItem(AcDb::kDxfSubclass,"CMyElevDim");<BR>&nbsp;filer-&gt;writePoint3d(AcDb::kDxfXCoord,mStartPoint);<BR>&nbsp;filer-&gt;writePoint3d(AcDb::kDxfXCoord+1,mSymbolPoint);<BR>&nbsp;filer-&gt;writePoint3d(AcDb::kDxfXCoord+2,mInsertPoint);<BR>&nbsp;filer-&gt;writeDouble(AcDb::kDxfReal,mHeight);<BR>&nbsp;filer-&gt;writeDouble(AcDb::kDxfReal+1,mLength);<BR>&nbsp;filer-&gt;writeDouble(AcDb::kDxfReal+2,mElevation);<BR>&nbsp;return filer-&gt;filerStatus();<BR>}</P>
<P>static Acad::ErrorStatus<BR>drawDim(const CMyElevDim * elevDim,<BR>&nbsp;&nbsp;AcGiWorldDraw *&nbsp; worldDraw,<BR>&nbsp;&nbsp;AcGiViewportDraw * vportDraw)<BR>{<BR>&nbsp;Acad::ErrorStatus es=Acad::eOk;<BR>&nbsp;AcGePoint3dArray vertexArray;<BR>&nbsp;if((es=elevDim-&gt;getVertices3d(vertexArray))!=Acad::eOk)<BR>&nbsp;{<BR>&nbsp;&nbsp;return es;<BR>&nbsp;}<BR>&nbsp;AcGePoint3d ptArray;<BR>&nbsp;for(int i=0;i&lt;vertexArray.length()-1; i++)<BR>&nbsp;{<BR>&nbsp;&nbsp;if(i==1)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;if(worldDraw!=NULL)<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;worldDraw-&gt;subEntityTraits().setSelectionMarker(4);<BR>&nbsp;&nbsp;&nbsp;&nbsp;ptArray=vertexArray;<BR>&nbsp;&nbsp;&nbsp;&nbsp;ptArray=vertexArray;<BR>&nbsp;&nbsp;&nbsp;&nbsp;worldDraw-&gt;geometry().polyline(2,ptArray);<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;assert(Adesk::kFalse);<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;continue;<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;if(worldDraw!=NULL)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;if(i==0)<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;worldDraw-&gt;subEntityTraits().setSelectionMarker(i+1);<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;worldDraw-&gt;subEntityTraits().setSelectionMarker(i);<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;else<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;assert(Adesk::kFalse);<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;ptArray=vertexArray;<BR>&nbsp;&nbsp;ptArray=vertexArray;<BR>&nbsp;&nbsp;if(worldDraw!=NULL)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;worldDraw-&gt;geometry().polyline(2,ptArray);<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;else<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;assert(Adesk::kFalse);<BR>&nbsp;&nbsp;}<BR>&nbsp;}<BR>&nbsp;if(worldDraw!=NULL)<BR>&nbsp;{<BR>&nbsp;&nbsp;AcGePoint3d insPt;<BR>&nbsp;&nbsp;AcGeVector3d normal(0,0,1),direction(1,0,0);<BR>&nbsp;&nbsp;double height,elev;<BR>&nbsp;&nbsp;char str;<BR>&nbsp;&nbsp;insPt=elevDim-&gt;getInsertPoint();<BR>&nbsp;&nbsp;acdbEcs2Wcs(asDblArray(insPt),asDblArray(insPt),<BR>&nbsp;&nbsp;&nbsp;asDblArray(AcGeVector3d(0,0,1)),Adesk::kFalse);<BR>&nbsp;&nbsp;height=elevDim-&gt;getHeight();<BR>&nbsp;&nbsp;elev=elevDim-&gt;getElevation();<BR>&nbsp;&nbsp;acdbRToS(elev,2,2,str);<BR>&nbsp;&nbsp;worldDraw-&gt;subEntityTraits().setSelectionMarker(5);<BR>&nbsp;&nbsp;worldDraw-&gt;geometry().text(insPt,normal,direction,height,0.8,0,str);<BR>&nbsp;}<BR>&nbsp;else<BR>&nbsp;{<BR>&nbsp;&nbsp;assert(Adesk::kFalse);<BR>&nbsp;}<BR>&nbsp;return es;<BR>}<BR>static Acad::ErrorStatus<BR>intLine(const CMyElevDim * elevDim,<BR>&nbsp;&nbsp;const AcGeLine3d line,<BR>&nbsp;&nbsp;AcGePoint3dArray&amp; points)<BR>{<BR>&nbsp;Acad::ErrorStatus es=Acad::eOk;<BR>&nbsp;AcGePoint3dArray vertexArray;<BR>&nbsp;if((es=elevDim-&gt;getVertices3d(vertexArray))!=Acad::eOk)<BR>&nbsp;{<BR>&nbsp;&nbsp;return es;<BR>&nbsp;}<BR>&nbsp;AcGeLineSeg3d tlnsg;<BR>&nbsp;AcGePoint3d pt;<BR>&nbsp;for(int i=0; i&lt;vertexArray.length()-1; i++)<BR>&nbsp;{<BR>&nbsp;&nbsp;if(i==1)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;tlnsg.set(vertexArray,vertexArray);<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;else<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;tlnsg.set(vertexArray,vertexArray);<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;if(!tlnsg.intersectWith(line,pt))<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;continue;<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;else<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;points.append(pt);<BR>&nbsp;&nbsp;}<BR>&nbsp;}<BR>&nbsp;return es;<BR>}</P>
<P>static Acad::ErrorStatus<BR>intLine(const CMyElevDim * elevDim,<BR>&nbsp;&nbsp;const AcDbLine * line,<BR>&nbsp;&nbsp;AcDb::Intersect intType,<BR>&nbsp;&nbsp;const AcGePlane *projPlane,<BR>&nbsp;&nbsp;AcGePoint3dArray &amp;points)<BR>{<BR>&nbsp;Acad::ErrorStatus es=Acad::eOk;<BR>&nbsp;AcGeLineSeg3d lnsg(line-&gt;startPoint(),line-&gt;endPoint());<BR>&nbsp;es=intLine(elevDim,lnsg,intType,projPlane,points);<BR>&nbsp;return es;<BR>}</P>
<P>static Acad::ErrorStatus<BR>intLine(const CMyElevDim * elevDim,<BR>&nbsp;&nbsp;const AcGeLineSeg3d lnsg,<BR>&nbsp;&nbsp;AcDb::Intersect intType,<BR>&nbsp;&nbsp;const AcGePlane *projPlane,<BR>&nbsp;&nbsp;AcGePoint3dArray &amp;points<BR>&nbsp;&nbsp;)<BR>{<BR>&nbsp;Acad::ErrorStatus es=Acad::eOk;<BR>&nbsp;AcGePoint3dArray vertexArray;<BR>&nbsp;if((es=elevDim-&gt;getVertices3d(vertexArray) )!=Acad::eOk)<BR>&nbsp;{<BR>&nbsp;&nbsp;return es;<BR>&nbsp;}<BR>&nbsp;AcGeLine3d aline(lnsg.startPoint(),lnsg.endPoint());<BR>&nbsp;AcGeLineSeg3d tlnsg;<BR>&nbsp;AcGePoint3d pt;<BR>&nbsp;AcGePoint3d dummy;<BR>&nbsp;for(int i=0; i&lt;vertexArray.length()-1; i++)<BR>&nbsp;{<BR>&nbsp;&nbsp;if(i==1)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;tlnsg.set(vertexArray,vertexArray);<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;else<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;tlnsg.set(vertexArray,vertexArray);<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;if(intType==AcDb::kExtendArg||intType==AcDb::kExtendBoth)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;if(projPlane==NULL)<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;if(!tlnsg.intersectWith(aline,pt))<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue;<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;points.append(pt);<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;if(!tlnsg.projIntersectWith(aline,projPlane-&gt;normal(),pt,dummy))<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue;<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;points.append(pt);<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;else<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;if(projPlane==NULL)<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;if(!tlnsg.intersectWith(lnsg,pt))<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue;<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;points.append(pt);<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;if(!tlnsg.projIntersectWith(lnsg,projPlane-&gt;normal(),pt,dummy))<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue;<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;points.append(pt);<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;}<BR>&nbsp;}<BR>&nbsp;return es;<BR>&nbsp;<BR>}</P>
<P><BR>static Acad::ErrorStatus<BR>intArc(const CMyElevDim * elevDim,<BR>&nbsp;&nbsp;&nbsp; const AcDbArc * arc,<BR>&nbsp;&nbsp;&nbsp; AcDb::Intersect intType,<BR>&nbsp;&nbsp;&nbsp; const AcGePlane *&nbsp; projPlane,<BR>&nbsp;&nbsp;&nbsp; AcGePoint3dArray &amp; points)<BR>{<BR>&nbsp;Acad::ErrorStatus es=Acad::eOk;<BR>&nbsp;AcGeCircArc3d aarc(arc-&gt;center(),arc-&gt;normal(),<BR>&nbsp;&nbsp;arc-&gt;normal().perpVector(),arc-&gt;radius(),<BR>&nbsp;&nbsp;arc-&gt;startAngle(),arc-&gt;endAngle());<BR>&nbsp;es=intArc(elevDim,aarc,intType,projPlane,points);<BR>&nbsp;return es;<BR>}<BR>static Acad::ErrorStatus<BR>intArc(const CMyElevDim * elevDim,<BR>&nbsp;&nbsp;&nbsp; const AcGeCircArc3d arc,<BR>&nbsp;&nbsp;&nbsp; AcDb::Intersect intType,<BR>&nbsp;&nbsp;&nbsp; const AcGePlane * projPlane,<BR>&nbsp;&nbsp;&nbsp; AcGePoint3dArray &amp; points)<BR>{<BR>&nbsp;Acad::ErrorStatus es=Acad::eOk;<BR>&nbsp;AcGePoint3dArray vertexArray;<BR>&nbsp;if((es=elevDim-&gt;getVertices3d(vertexArray))!=Acad::eOk)<BR>&nbsp;{<BR>&nbsp;&nbsp;return es;<BR>&nbsp;}<BR>&nbsp;AcGeCircArc3d acircle(arc.center(),arc.normal(),arc.radius());<BR>&nbsp;AcGeLineSeg3d lnsg;<BR>&nbsp;AcGePoint3d pt1,pt2;<BR>&nbsp;AcGePoint3d dummy1 ,dummy2;<BR>&nbsp;int howMany;<BR>&nbsp;for(int i=0; i&lt;vertexArray.length()-1; i++)<BR>&nbsp;{<BR>&nbsp;&nbsp;if(i==1)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;lnsg.set(vertexArray,vertexArray);<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;else<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;lnsg.set(vertexArray,vertexArray);<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;if(intType==AcDb::kExtendArg||intType==AcDb::kExtendBoth)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;if(projPlane==NULL)<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;if(!acircle.intersectWith(lnsg,howMany,pt1,pt2))<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue;<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(howMany&gt;1)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;points.append(pt1);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;points.append(pt2);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;points.append(pt1);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;if(!acircle.projIntersectWith(lnsg,projPlane-&gt;normal(),<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;howMany,pt1,pt2,dummy1,dummy2))<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue;<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(howMany&gt;1)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;points.append(pt1);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;points.append(pt2);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;points.append(pt1);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;else<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;if(projPlane==NULL)<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;if(!arc.intersectWith(lnsg,howMany,pt1,pt2))<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue;<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(howMany&gt;1)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;points.append(pt1);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;points.append(pt2);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;points.append(pt1);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;if(!arc.projIntersectWith(lnsg,projPlane-&gt;normal(),<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;howMany,pt1,pt2,dummy1,dummy2))<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue;<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(howMany&gt;1)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;points.append(pt1);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;points.append(pt2);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;points.append(pt1);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;}</P>
<P>&nbsp;}<BR>&nbsp;return es;<BR>}</P>
<P>static Acad::ErrorStatus<BR>intCircle(const CMyElevDim * elevDim,<BR>&nbsp;&nbsp;&nbsp; const AcDbCircle * circle,<BR>&nbsp;&nbsp;&nbsp; AcDb::Intersect&nbsp; intType,<BR>&nbsp;&nbsp;&nbsp; AcGePlane * projPlane,<BR>&nbsp;&nbsp;&nbsp; AcGePoint3dArray &amp; points)<BR>{<BR>&nbsp;Acad::ErrorStatus es=Acad::eOk;<BR>&nbsp;AcGeCircArc3d acircle(circle-&gt;center(),circle-&gt;normal(),circle-&gt;radius());<BR>&nbsp;es=intCircle(elevDim,acircle,intType,projPlane,points);<BR>&nbsp;return es;<BR>}</P>
<P>static Acad::ErrorStatus<BR>intCircle(const CMyElevDim * elevDim,<BR>&nbsp;&nbsp;&nbsp; const AcDbCircle * circle,<BR>&nbsp;&nbsp;&nbsp; AcDb::Intersect intType,<BR>&nbsp;&nbsp;&nbsp; const AcGePlane * projPlane,<BR>&nbsp;&nbsp;&nbsp; AcGePoint3dArray &amp; points)<BR>{<BR>&nbsp;Acad::ErrorStatus es=Acad::eOk;<BR>&nbsp;AcGePoint3dArray vertexArray;<BR>&nbsp;if((es=elevDim-&gt;getVertices3d(vertexArray))!=Acad::eOk)<BR>&nbsp;{<BR>&nbsp;&nbsp;return es;<BR>&nbsp;}<BR>&nbsp;AcGeLineSeg3d lnsg;<BR>&nbsp;AcGePoint3d pt1,pt2;<BR>&nbsp;AcGePoint3d dummy1,dummy2;<BR>&nbsp;int howMany;<BR>&nbsp;for(int i=0; i&lt;vertexArray.length()-1; i++)<BR>&nbsp;{<BR>&nbsp;&nbsp;if(i==1)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;lnsg.set(vertexArray,vertexArray);<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;else<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;lnsg.set(vertexArray,vertexArray);<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;if(projPlane==NULL)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;if(!circle.intersectWith(lnsg,howMany,pt1,pt2))<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;continue;<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;if(howMany&gt;1)<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;points.append(pt1);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;points.append(pt2);<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;points.append(pt1);<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;else<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;if(!circle.projIntersectWith(lnsg,projPlane-&gt;normal(),<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;howMany,pt1,pt2,dummy1,dummy2))<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;continue;<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;if(howMany&gt;1)<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;points.append(pt1);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;points.append(pt2);<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;points.append(pt1);<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;}<BR>&nbsp;}<BR>&nbsp;return es;<BR>}</P>
<P>Acad::ErrorStatus<BR>addToModelSpace(AcDbObjectId &amp; objId,AcDbEntity *pEntity)<BR>{<BR>&nbsp;Acad::ErrorStatus es=Acad::eOk;<BR>&nbsp;AcDbBlockTable * pBlockTable;<BR>&nbsp;AcDbBlockTableRecord *pSpaceRecord;<BR>&nbsp;acdbHostApplicationServices()-&gt;workingDatabase()<BR>&nbsp;&nbsp;-&gt;getSymbolTable(pBlockTable,AcDb::kForRead);<BR>&nbsp;pBlockTable-&gt;getAt(ACDB_MODEL_SPACE,pSpaceRecord,AcDb::kForWrite);<BR>&nbsp;pSpaceRecord-&gt;appendAcDbEntity(objId,pEntity);<BR>&nbsp;pBlockTable-&gt;close();<BR>&nbsp;pEntity-&gt;close();<BR>&nbsp;pSpaceRecord-&gt;close();<BR>&nbsp;return es;<BR>}</P>
<P>void elevDim()<BR>{<BR>&nbsp;ads_name ename;<BR>&nbsp;AcGePoint3d pt;<BR>&nbsp;if(acedEntSel("\nPick a line:",ename,asDblArray(pt))!=RTNORM)<BR>&nbsp;{<BR>&nbsp;&nbsp;acutPrintf("\nPick entity fail!");<BR>&nbsp;&nbsp;return;<BR>&nbsp;}<BR>&nbsp;AcDbObjectId objId;<BR>&nbsp;AcDbLine * pLine;<BR>&nbsp;acdbGetObjectId(objId,ename);<BR>&nbsp;if(acdbOpenAcDbEntity((AcDbEntity * &amp;)pLine,<BR>&nbsp;&nbsp;objId,AcDb::kForRead)!=Acad::eOk)<BR>&nbsp;{<BR>&nbsp;&nbsp;return;<BR>&nbsp;}<BR>&nbsp;AcGePoint3d startPt,endPt;<BR>&nbsp;if(pLine!=NULL)<BR>&nbsp;{<BR>&nbsp;&nbsp;startPt=pLine-&gt;startPoint();<BR>&nbsp;&nbsp;endPt=pLine-&gt;endPoint();<BR>&nbsp;&nbsp;pLine-&gt;close();<BR>&nbsp;}<BR>&nbsp;else<BR>&nbsp;{<BR>&nbsp;&nbsp;return;<BR>&nbsp;}<BR>&nbsp;if(fabs(startPt.y-endPt.y)&gt;1e-10)<BR>&nbsp;{<BR>&nbsp;&nbsp;acutPrintf("\nThe line must be horizontal!");<BR>&nbsp;&nbsp;return;<BR>&nbsp;}<BR>&nbsp;double height=10.0;<BR>&nbsp;double length=50.0;<BR>&nbsp;AcGePoint3d startPoint;<BR>&nbsp;if(acedGetPoint(NULL,"\nPlease input start point:",asDblArray(startPoint))!=RTNORM)<BR>&nbsp;{<BR>&nbsp;&nbsp;return;<BR>&nbsp;}<BR>&nbsp;startPoint.set(startPoint.x,startPt.y,startPoint.z);<BR>&nbsp;acdbWcs2Ecs(asDblArray(startPoint),asDblArray(startPoint),<BR>&nbsp;&nbsp;asDblArray(AcGeVector3d(0,0,1)),Adesk::kFalse);<BR>&nbsp;CMyElevDim * pDim=new CMyElevDim;<BR>&nbsp;if(pDim==NULL)<BR>&nbsp;{<BR>&nbsp;&nbsp;ads_printf("\nOut of memory");<BR>&nbsp;&nbsp;return;<BR>&nbsp;}<BR>&nbsp;pDim-&gt;set(startPoint,height,length);<BR>&nbsp;pDim-&gt;setDatabaseDefaults(acdbHostApplicationServices()-&gt;workingDatabase());<BR>&nbsp;if(addToModelSpace(objId,pDim)!=Acad::eOk)<BR>&nbsp;{<BR>&nbsp;&nbsp;delete pDim;<BR>&nbsp;}<BR>&nbsp;return ;</P>
<P>}</P>
<P><BR>void initApp()<BR>{<BR>&nbsp;acedRegCmds-&gt;addCommand("ASDK_CUSTOMENTITY_COMMANDS",<BR>&nbsp;&nbsp;"ELEVDIM",<BR>&nbsp;&nbsp;"ELEVDIM",<BR>&nbsp;&nbsp;ACRX_CMD_MODAL,<BR>&nbsp;&nbsp;elevDim);<BR>&nbsp;CMyElevDim::rxInit();<BR>&nbsp;acrxBuildClassHierarchy();<BR>}<BR>void unloadApp()<BR>{<BR>&nbsp;acedRegCmds-&gt;removeGroup("ASDK_CUSTOMENTITY_COMMANDS");<BR>&nbsp;deleteAcRxClass(CMyElevDim::desc());<BR>}</P>
<P>AcRx::AppRetCode<BR>acrxEntryPoint(AcRx::AppMsgCode msg,void *pkt)<BR>{<BR>&nbsp;switch(msg)<BR>&nbsp;{<BR>&nbsp;case AcRx::kInitAppMsg:<BR>&nbsp;&nbsp;acrxUnlockApplication(pkt);<BR>&nbsp;&nbsp;acrxRegisterAppMDIAware(pkt);<BR>&nbsp;&nbsp;initApp();<BR>&nbsp;&nbsp;break;<BR>&nbsp;case AcRx::kUnloadAppMsg:<BR>&nbsp;&nbsp;unloadApp();<BR>&nbsp;&nbsp;break;<BR>&nbsp;}<BR>&nbsp;return AcRx::kRetOK;<BR>}</P>
页: 1 2 [3]
查看完整版本: 初学建议