lwh-1234 发表于 2005-9-7 10:40:00

[ARX] SOS求助:尺寸标注方面问题!!!!!!!

<P>我是一个ARX二次开发CAD的新手,做了一个尺寸自动标注的程序,部分代码如下:</P>
<P>AcDbDatabase *pcurdb=acdbHostApplicationServices()-&gt;workingDatabase();<BR>&nbsp;&nbsp;&nbsp;AcDbDimStyleTable *pnewdimtable;<BR>&nbsp;&nbsp;&nbsp;pcurdb-&gt;getSymbolTable(pnewdimtable,AcDb::kForWrite);<BR>&nbsp;&nbsp;&nbsp;AcDbDimStyleTableRecord *pnewdimrecord=new AcDbDimStyleTableRecord();<BR>&nbsp;&nbsp;&nbsp;pnewdimrecord-&gt;setDimasz(20);//设置箭头大小<BR>&nbsp;&nbsp;&nbsp;pnewdimrecord-&gt;setDimzin(8);//十进制小数显示时,抑制后续零<BR>&nbsp;&nbsp;&nbsp;pnewdimrecord-&gt;setDimexe(30);//设置尺寸界线超出尺寸线距离为400<BR>&nbsp;&nbsp;&nbsp;pnewdimrecord-&gt;setDimexo(0);//设置尺寸界线的起点偏移量为300<BR>&nbsp;&nbsp;&nbsp;pnewdimrecord-&gt;setDimtxt(30);//设置文字高度<BR>&nbsp;&nbsp;&nbsp;pnewdimrecord-&gt;setDimtad(1);//设置文字位置-垂直为上方,水平默认为居中,不用设置<BR>&nbsp;&nbsp;&nbsp;pnewdimrecord-&gt;setDimgap(10);//设置文字位置-从尺寸线的偏移量<BR>&nbsp;&nbsp;&nbsp;pnewdimrecord-&gt;setDimtih(0);&nbsp; <BR>&nbsp;&nbsp;&nbsp;pnewdimrecord-&gt;setDimtix(1);//设置标注文字始终绘制在尺寸界线之间<BR>&nbsp;&nbsp;&nbsp;pnewdimrecord-&gt;setDimtofl(1);//即使箭头放置于测量点之外,尺寸线也将绘制在测量点之间<BR>&nbsp;&nbsp;//&nbsp;pnewdimrecord-&gt;setDimgap(0.5);<BR>&nbsp;&nbsp;&nbsp;color.setColorIndex(iDimColor); <BR>&nbsp;&nbsp;&nbsp;pnewdimrecord-&gt;setDimclrd(color);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //尺寸线颜色 <BR>&nbsp;&nbsp;&nbsp;pnewdimrecord-&gt;setDimclre(color);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //尺寸边界线颜色 <BR>&nbsp;&nbsp;&nbsp;color.setColorIndex(iTextColor);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;pnewdimrecord-&gt;setDimclrt(color);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //文字颜色 </P>
<P>&nbsp;&nbsp;&nbsp;AcDbObjectId dimrecordid;<BR>&nbsp;&nbsp;&nbsp;pnewdimtable-&gt;add(dimrecordid,pnewdimrecord);<BR>&nbsp;&nbsp;&nbsp;pnewdimtable-&gt;close();<BR>&nbsp;&nbsp;&nbsp;pnewdimrecord-&gt;close();<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;AcGePoint3d Pt1(KD.ZB_X+t,KD.ZB_Y+t,0); <BR>&nbsp;&nbsp;&nbsp;AcGePoint3d Pt2(DY.m_Chang+t,KD.ZB_Y+t,0);<BR>&nbsp;&nbsp;&nbsp;AcGePoint3d Pt3(KD.ZB_X+t,DY.m_Kuan+t+150+k*70,0);<BR>&nbsp;&nbsp;&nbsp;AcGePoint3d Pt6(KD.ZB_X+t-KD.KongJing/2*cos(PI/4.0),KD.ZB_Y+t+KD.KongJing/2*sin(PI/4.0),0); <BR>&nbsp;&nbsp;&nbsp;AcGePoint3d Pt7(KD.ZB_X+t+KD.KongJing/2*cos(PI/4.0),KD.ZB_Y+t-KD.KongJing/2*sin(PI/4.0),0); <BR>&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;AcDbBlockTable *pBlockTable;//定义块表指针<BR>&nbsp;&nbsp;&nbsp;acdbHostApplicationServices()-&gt;workingDatabase()<BR>&nbsp;&nbsp;&nbsp;-&gt;getSymbolTable(pBlockTable, AcDb::kForRead);<BR>&nbsp;&nbsp;&nbsp;AcDbBlockTableRecord *pBlockTableRecord;<BR>&nbsp;&nbsp;&nbsp;pBlockTable-&gt;getAt(ACDB_MODEL_SPACE, pBlockTableRecord,<BR>&nbsp;&nbsp;&nbsp;AcDb::kForWrite);<BR>&nbsp;&nbsp;&nbsp;pBlockTable-&gt;close();<BR>&nbsp;&nbsp;&nbsp;AcDbAlignedDimension *pDim1 = new AcDbAlignedDimension(Pt1, Pt2,Pt3,NULL,dimrecordid);<BR>&nbsp;&nbsp;&nbsp;AcDbDiametricDimension *pDim3 = new AcDbDiametricDimension(Pt6, Pt7,leaderLength,dimText,dimrecordid);<BR>&nbsp;&nbsp;&nbsp;pDim3-&gt;setLeaderLength(20);<BR>&nbsp;&nbsp;&nbsp;AcDbObjectId Id;<BR>&nbsp;&nbsp;&nbsp;pBlockTableRecord-&gt;appendAcDbEntity(Id, pDim1);<BR>&nbsp;&nbsp;&nbsp;pBlockTableRecord-&gt;appendAcDbEntity(Id, pDim3);<BR>&nbsp;&nbsp;&nbsp;pBlockTableRecord-&gt;close();<BR>&nbsp;&nbsp;&nbsp;pDim1-&gt;close();<BR>&nbsp;&nbsp;&nbsp;pDim3-&gt;close();</P>
<P>现在我希望标出的值是图形实际尺寸的一半,而不是尺寸的实际值,不知道对程序怎样操作。恳请高手不吝赐教,再次表示感谢,鲜花赠上</P>

wuddy 发表于 2005-9-8 11:18:00

<P>AcDbRotatedDimension *pdim;pdim-&gt;setDimlfac(0.5)就可以了</P>

lwh-1234 发表于 2005-9-12 09:40:00

<P>谢谢<A name=55648><FONT color=#000066><B>wuddy</B></FONT></A>的热心指教,问题解决了。</P>
<P>再次表示感谢!!</P>

hourui800720 发表于 2011-7-30 11:22:42

为什么在我的电脑上运行有问题
页: [1]
查看完整版本: [ARX] SOS求助:尺寸标注方面问题!!!!!!!