设为首页收藏本站

中国膜结构网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

膜结构车棚
膜结构车棚膜结构资质国产膜材 膜结构网中国膜结构协会
查看: 153|回复: 0

CAD ObjectARX扩展工具的源码2

[复制链接]
  • TA的每日心情
    开心
    2021-6-19 14:40
  • 签到天数: 1539 天

    [LV.Master]伴坛终老

    发表于 2020-12-29 14:05 | 显示全部楼层 |阅读模式
    1. //
    2. //
    3. AcDbObjectId CDrawFunction::createtextAll(AcGePoint3d pt,char *text,AcDb::TextHorzMode hMode,AcDb::TextertMode Mode,double hight,double widthFactor,double rotation,int color,CString smallFontName,CString bigFontName,CString layerName)
    4. {
    5. ASSERT(text!=NULL);
    6. AcDbText *pText=NULL;
    7. pText=new AcDbText;
    8. if(pText==NULL)
    9. throw Acad::eOutOfMemory;
    10. AcDbObjectId textId;
    11. textId=createTextStyle(smallFontName,bigFontName,"xianlu");
    12. pText->setTextStyle(textId);
    13. pText->setTextString(text);
    14. pText->setHeight(hight);
    15. pText->setColorIndex(color);
    16. pText->setRotation(rotation);
    17. pText->setWidthFactor(widthFactor);
    18. pText->setPosition(pt);
    19. if(layerName!="")
    20. pText->setLayer(layerName.GetBuffer(0));
    21. addToModelSpace(textId, pText);
    22. pText->close();
    23. return textId;
    24. }

    25. //设置尺寸文本样式
    26. oid CDrawFunction::setDimTextStyle(AcDbObjectId dimId,AcDbObjectId textStyleId,
    27. int colorIndex,double textHeight,double textScator,
    28. double textGap,bool align)
    29. {
    30. AcDbDimension *dimText;
    31. acdbOpenObject(dimText,dimId,AcDb::kForWrite);
    32. dimText->setDimtxsty(textStyleId); //文本字体DIMTXSTY
    33. AcCmColor color;
    34. color.setColorIndex(colorIndex);
    35. dimText->setDimclrt(color);//文本颜色DIMCLRT
    36. dimText->setDimtxt(textHeight); //文本高度DIMTXT
    37. dimText->setDimtfac(textScator);//文本高宽比DIMTFAC
    38. dimText->setDimgap(textGap);//文本距尺寸距离DIMGAP
    39. dimText->setDimtoh(align);//文本标注DIMTOH
    40. dimText->close();
    41. }

    42. //设置尺寸延伸线类型
    43. Acad::ErrorStatus CDrawFunction::setextensionlineStyle(AcDbObjectId dimId,int colorIndex,double length,
    44. double offLength,bool 1,bool 2)
    45. {
    46. Acad::ErrorStatus es=Acad::eOk;
    47. AcDbDimension *dimText=NULL;
    48. if((es=acdbOpenObject(dimText,dimId,AcDb::kForWrite))!=Acad::eOk)
    49. return es;
    50. AcCmColor color;
    51. if((es=color.setColorIndex(colorIndex))!=Acad::eOk)
    52. {
    53. dimText->close();return es;
    54. }
    55. dimText->setDimclre(color);//设置颜色DIMCLRE
    56. dimText->setDimexe(length);//设置超出长度DIMEXE
    57. dimText->setDimexo(offLength);//尺寸偏离长度DIMEXO
    58. dimText->setDimse1(1);//是否注第一条线DIMSE1
    59. dimText->setDimse2(2);//是否注第二条线DIMSE2
    60. dimText->close();
    61. return es;
    62. }
    63. //绘制对齐尺寸线
    64. AcDbObjectId CDrawFunction::drawDimension(AcGePoint3d xLine1Point,AcGePoint3d xLine2Point,
    65. double fwj,int direction,double distance,CString dimText,CString m_cLayerName)
    66. {

    67. AcDbAlignedDimension *dimension=new AcDbAlignedDimension;
    68. AcGePoint3d dimLinePoint;
    69. // CCalcuMethod *calcu=new CCalcuMethod();
    70. // calcu->calEndZbSelf(xLine2Point,distance*direction,fwj,dimLinePoint);
    71. // delete calcu;calcu=NULL;
    72. dimension->setXLine1Point(xLine1Point);
    73. dimension->setDimLinePoint(dimLinePoint);
    74. dimension->setXLine2Point(xLine2Point);
    75. dimension->setDimensionText(dimText.GetBuffer(0));
    76. dimension->setLayer(m_cLayerName.GetBuffer(0));
    77. AcDbObjectId dimId;
    78. addToModelSpace(dimId,dimension);
    79. dimension->close();
    80. return dimId;
    81. }

    82. Acad::ErrorStatus CDrawFunction::createLine(AcDbObjectId &lineId,AcGePoint3d startPt,AcGePoint3d endPt,int color,CString Layer,char *linetype)
    83. {
    84. Acad::ErrorStatus es=Acad::eOk;
    85. ASSERT(linetype!=NULL);
    86. AcDbLine *pLine = new AcDbLine(startPt, endPt);
    87. if((es=pLine->setColorIndex(color))!=Acad::eOk)
    88. {
    89. pLine->close();return es;
    90. }
    91. if(Layer!="")
    92. {
    93. if(pLine->setLayer(Layer)==Acad::eKeyNotFound \
    94. ||pLine->setLayer(Layer)==Acad::eDeletedEntry )
    95. {
    96. createNewLayer(Layer);
    97. if((es=pLine->setLayer(Layer.GetBuffer(0)))!=Acad::eOk)
    98. {
    99. pLine->close();return es;
    100. }
    101. }
    102. }
    103. if(linetype!=NULL)
    104. {
    105. AcDbObjectId lineTypeId;
    106. if(getLinetypeIdFromString(linetype,lineTypeId))
    107. {
    108. if((es=pLine->setLinetype(lineTypeId))!=Acad::eOk)
    109. {
    110. pLine->close();return es;
    111. }
    112. if((es=pLine->setLinetypeScale(1))!=Acad::eOk)
    113. {
    114. pLine->close();return es;
    115. }
    116. }
    117. }
    118. es=addToModelSpace(lineId,pLine);
    119. return es;
    120. }

    121. Acad::ErrorStatus CDrawFunction::createCircle(AcDbObjectId& circleId,AcGePoint3d center,double radius,int color,CString layer)
    122. {
    123. Acad::ErrorStatus es=Acad::eOk;
    124. AcGeector3d normal(0,0,1);
    125. AcDbCircle *circle=new AcDbCircle(center,normal,radius);
    126. if((es=circle->setColorIndex(color))!=Acad::eOk)
    127. {
    128. circle->close();return es;
    129. }
    130. if(layer!="")
    131. {
    132. if(circle->setLayer(layer)==Acad::eKeyNotFound \
    133. ||circle->setLayer(layer)==Acad::eDeletedEntry )
    134. {
    135. createNewLayer(layer);
    136. if((es=circle->setLayer(layer.GetBuffer(0)))!=Acad::eOk)
    137. {
    138. circle->close();return es;
    139. }
    140. }
    141. }
    142. es=addToModelSpace(circleId,circle);
    143. return es;
    144. }


    145. Acad::ErrorStatus CDrawFunction::DrawPolyline(AcDbObjectId& polylineId, AcGePoint3dArray ptArr, int Color, double Width,bool IsClose,CString Layer,char *linetype)
    146. {
    147. Acad::ErrorStatus es=Acad::eOk;
    148. AcDb2dPolyline *pNewPline;
    149. if(IsClose)pNewPline=new AcDb2dPolyline(AcDb::k2dSimplePoly,ptArr,0,Adesk::kTrue,Width,Width);
    150. else pNewPline=new AcDb2dPolyline(AcDb::k2dSimplePoly,ptArr,0,Adesk::kFalse,Width,Width);
    151. if((es=pNewPline->setColorIndex(Color))!=Acad::eOk)
    152. {
    153. pNewPline->close();return es;
    154. }
    155. if(Layer!="")
    156. {
    157. if(pNewPline->setLayer(Layer)==Acad::eKeyNotFound \
    158. ||pNewPline->setLayer(Layer)==Acad::eDeletedEntry )
    159. {
    160. createNewLayer(Layer);
    161. if((es=pNewPline->setLayer(Layer))!=Acad::eOk)
    162. {
    163. pNewPline->close();return es;
    164. }
    165. }
    166. }
    167. if(linetype!=NULL)
    168. {
    169. AcDbObjectId lineTypeId;
    170. if(getLinetypeIdFromString(linetype,lineTypeId))
    171. {
    172. if((es=pNewPline->setLinetype(lineTypeId))!=Acad::eOk)
    173. {
    174. pNewPline->close();return es;
    175. }
    176. if((es=pNewPline->setLinetypeScale(1))!=Acad::eOk)
    177. {
    178. pNewPline->close();return es;
    179. }
    180. }
    181. }
    182. if(!pNewPline->isLinetypeGenerationOn())
    183. {
    184. if((es=pNewPline->setLinetypeGenerationOn())!=Acad::eOk)
    185. {
    186. pNewPline->close();return es;
    187. }
    188. }
    189. es=addToModelSpace(polylineId,pNewPline);
    190. return es;
    191. }

    192. Acad::ErrorStatus CDrawFunction::DrawSplinePolyline(AcDbObjectId& polylineId, AcGePoint3dArray ptArr, int Color, double Width,bool IsClose,CString Layer,char *linetype)
    193. {
    194. Acad::ErrorStatus es=Acad::eOk;
    195. AcDb2dPolyline *pNewPline;
    196. if(IsClose)pNewPline=new AcDb2dPolyline(AcDb::k2dQuadSplinePoly,ptArr,0,Adesk::kTrue,Width,Width);
    197. else pNewPline=new AcDb2dPolyline(AcDb::k2dQuadSplinePoly,ptArr,0,Adesk::kFalse,Width,Width);
    198. if((es=pNewPline->setColorIndex(Color))!=Acad::eOk)
    199. {
    200. pNewPline->close();return es;
    201. }
    202. if(Layer!="")
    203. {
    204. if(pNewPline->setLayer(Layer)==Acad::eKeyNotFound \
    205. ||pNewPline->setLayer(Layer)==Acad::eDeletedEntry )
    206. {
    207. createNewLayer(Layer);
    208. if((es=pNewPline->setLayer(Layer))!=Acad::eOk)
    209. {
    210. pNewPline->close();return es;
    211. }
    212. }
    213. }
    214. if(linetype!=NULL)
    215. {
    216. AcDbObjectId lineTypeId;
    217. if(getLinetypeIdFromString(linetype,lineTypeId))
    218. {
    219. if((es=pNewPline->setLinetype(lineTypeId))!=Acad::eOk)
    220. {
    221. pNewPline->close();return es;
    222. }
    223. if((es=pNewPline->setLinetypeScale(1))!=Acad::eOk)
    224. {
    225. pNewPline->close();return es;
    226. }
    227. }
    228. }
    229. if(!pNewPline->isLinetypeGenerationOn())
    230. {
    231. if((es=pNewPline->setLinetypeGenerationOn())!=Acad::eOk)
    232. {
    233. pNewPline->close();return es;
    234. }
    235. }
    236. es=addToModelSpace(polylineId,pNewPline);
    237. return es;
    238. }
    239. 分享:
    复制代码
    回复


    http://www.mjgw.org/ 专业从事膜结构设计、制作加工、施工安装的膜结构工程服务,能够为客户提供专业的膜结构整体解决方案。做中国最好的膜结构综合服务平台。欢迎大家联系电话:198-7840-1958,QQ:463017170.
    相关关键词:膜结构车棚,膜结构车棚覆盖,膜结构车棚公司,膜结构车棚多少钱,膜结构车棚厂家,膜结构车棚价格,社区膜结构车棚,膜结构车棚膜布厂家 ,膜结构车棚哪家好,膜结构车棚多少钱一米,膜结构车棚报价,膜结构车棚哪里有,膜结构车棚定制,膜结构车棚安装,膜结构车棚设计,膜结构车棚电话,膜结构车棚加工,膜结构车棚膜布价格,膜结构车棚批发,膜结构车棚制造商,膜结构车棚生产厂家,膜结构车棚设计,膜结构车棚施工,膜结构车棚多少钱一平米,膜结构车棚订制,张拉膜车棚,张拉膜车棚覆盖,张拉膜车棚公司,张拉膜车棚多少钱,张拉膜车棚厂家,张拉膜车棚价格,社区张拉膜车棚,张拉膜车棚膜布厂家 ,张拉膜车棚哪家好,张拉膜车棚多少钱一米,张拉膜车棚报价,张拉膜车棚哪里有,张拉膜车棚定制,张拉膜车棚安装,张拉膜车棚设计,张拉膜车棚电话,张拉膜车棚加工,张拉膜车棚膜布价格,张拉膜车棚批发,张拉膜车棚制造商,张拉膜车棚生产厂家,张拉膜车棚设计,张拉膜车棚施工,张拉膜车棚多少钱一平米,张拉膜车棚订制,常用膜材品牌:德国杜肯、法国法拉利、德国海德斯、德国米乐、日本平岗、韩国秀博、比利时希运、美国赫虏伯、中国科宝、上海慧遥。

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    关闭

    推荐膜材品牌上一条 /6 下一条

    进口膜材 国产膜材 pvdf膜材ptfe膜材ETFE膜材
    最好的膜结构公司 一级膜结构资质 膜结构一级资质
    膜结构设计-膜结构十大品牌-etfe设计-充气膜结构
    诺科膜结构
    遨都膜结构设计
    中国膜结构网
    中国空间膜结构

    QQ|申请友链|手机版|中国膜结构论坛