您的位置 首页 百科问答

cad怎么自动标注面积

cad怎么自动标注面积

CAD没有自动标注面积来自的命令,但可用LISP编写一段程序来完成,如下

;cad自动标注面积(封闭多段线和样条曲线、圆、椭圆的面积)

(defunc:bzmj()

(setqcmd(getvar"cmdecho"))

(s360问答etqosm(getvar"osmode"))

(setvar"cmdecho"0)

(setvar"osmode"0)

(command"_undo""be")

(if(p害右况假盾rogn

(princ"\n者请选取标注:")

(setqssa(ssget'((0."LwPolyLine,Spline,Circle,Ellipse"))))

)

(progn

(setqi0)

(setqn(sslengthssa))

(re散械项否树peatn

(setqent(ssnamessai))

(setqobj(vlax-ename->vla-objectent))

(setqName(vla影线封左益分团注十浓原x-get-proper第此清理应tyobj"ObjectName"))

(setqMjz(vlax-curve-getareaobj))

(setqp象粮吸室派色令丝跳众tCennil)

(cond((wcmatchName"AcDbPolyline,AcDbSpline")

(if(=(vlax-get-propertyobj"Closed"):vlax-true)

(progn

(vla-GetBoundingBoxobj'ptmin'ptm谓虽ax)

(setq象武审封突浓ptmin(vlax-saf族晶千夜唱普earray->listptmin))

(setqpt地些封书却工赵鲜max(vlax-safearray->listptmax))

(setqptCen(mapcar'(lambda(ab)(*0.5(+ab)))ptminptmax))

胶怕办杆表)

)

)

((wcmatchN念顶信减顶应渐言ame"AcDbCircle界拿胡收识技举答际列始,AcDbEllip华危se")

(setqptCen(vlax-safearray->list(vlax-variant-val村马ue(vlax-get-propertyobj"Center"))))

(If(and(=name"AcDbEllipse")

(/=(abs(-(vlax-get-propertyobj"EndAngle")

(vlax-get-propertyobj"StartAngle")

)

)

(*2.0pi)

)

)

(setqptCennil)

)

)

)

(if(/=ptCennil)

(command"_text""j""mc"ptCen2.50(strcat"面积="(rtosmjz23)))

)

(setqi(1+i))

)

)

)

(command"_undo""e")

(setvar"osmode"osm)

(setvar"cmdecho"cmd)

(princ)

)

上一篇 消毒产品管理办法
下一篇 最新公路路面基层施工技术规范介绍?
扫一扫,手机访问

扫一扫,手机浏览