-=MAPLE GALAXY=- Forum Index

-=MAPLE GALAXY=-
MapleStory Galaxy Private Server
 

CAD统计长度

 
Post new topic   Reply to topic    -=MAPLE GALAXY=- Forum Index -> 1st Pelase Vote for Maple Galaxy!
View previous topic :: View next topic  
Author Message
ghdhair100
Chief Gray



Joined: 15 Dec 2010
Posts: 2020
Read: 0 topics

Warns: 0/5
Location: England

PostPosted: Thu 11:37, 03 Mar 2011    Post subject: CAD统计长度

;;;===================
;;;面积和长度统计程序
;;;highflybird kunming
;;;===================
(prompt "命令为:AM")
(defun C:am (/ f ss l i SSarea totlen entlen
ename name obj text-S text-L insPt0 height
insPt1 insPt2 text-1 text-2 *APP *DOC *MSP
)
(vl-load-com)
(setq *APP (vlax-get-acad-object))
(setq *DOC (vla-get-activeDocument *APP))
(setq *MSP (vla-get-Modelspace *DOC))
(initget 1 "1 2 3")
(setq f (getkword "\n请输入你要统计的<1>面积<2>长度<3>两者:"))
(if
(and
(setq ss (ssget))
(setq insPt0 (getpoint "\n请输入文字插入点: "))
(setq height (getdist "\n请输入文字高度:"))
)
(progn
(setq l (sslength ss))
(setq i 0)
(setq SSarea 0)
(setq totlen 0)
(setq insPt1 (vlax-3d-point insPt0))
(setq insPt2 (polar insPt0 (* 1.5 Pi) (* 1.5 height)))
(setq insPt2 (vlax-3d-point insPt2))
(cond
( (= f "1")
(repeat l
(func-1)
(func-2)
(setq i (1+ i))
)
(setq text-S (strcat (convert1 SSarea 6) "平方米"));总面积为:小数后6位
(vla-addtext *MSP text-S insPt1 height)
)
( (= f "2")
(repeat l
(func-1)
(func-3)
(setq i (1+ i))
)
(setq text-L (strcat (convert1 totlen 3) "米")) ;总长度为:小数后3位
(vla-addtext *MSP text-L insPt2 height)
)
( (= f "3")
(repeat l
(func-1)
(func-2)
(func-3)
(setq i (1+ i))
)
(setq text-S (strcat (convert1 SSarea 6) "平方米"));总面积为:小数后6位
(setq text-L (strcat (convert1 totlen 3) "米")) ;总长度为:小数后3位
(vla-addtext *MSP text-S insPt1 height)
(vla-addtext *MSP text-L insPt2 height)
)
)
)
(alert "你没有选取物体或者输入正确的数据!")
)
(princ)
)
(defun func-1 ()
(setq ename (ssname ss i))
(setq obj (vlax-ename->vla-object ename))
(setq elist (entget ename))
(setq name (cdr (assoc 0 elist)))
)Many years ago there lived an Emperor who was so exceedingly fond of fine new clothes that he spent vast sums of money on dress. To him clothes meant more than anything else in the world. He took no interes
related links:


[link widoczny dla zalogowanych]


The post has been approved 0 times
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    -=MAPLE GALAXY=- Forum Index -> 1st Pelase Vote for Maple Galaxy! All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


fora.pl - załóż własne forum dyskusyjne za darmo
Powered by phpBB © 2001, 2005 phpBB Group
deoxBlue v1.0 // Theme created by Sopel stylerbb.net & programosy.pl

Regulamin