autolisp提示错误 参数太少
cad自动拆图的一个编码运行后提示参数太少,求高手指教,谢谢!(defunc:be(/woptiptxptylselnaocewidesalnnumfenflaslapt...
cad自动拆图的一个编码运行后提示参数太少,求高手指教,谢谢!
(defun c:be(/wo pti ptx pty lse lna oce wide sal n num fen fla sla pt tp1 num1 nam lname)
(setq oce (getvar "cmdecho")) ;自动拆分组立图
(setvar "cmdecho" 0 )
(setq wor (getstring"请确认文件中'group'处于'group off'状态(回车确认),否则立即按'ECS'键退出!"))
(if (= wor "" )(princ"正在拆分组立图,请稍后!谢谢!"))
(command"rotate" "all" "" "0,0" "90")
(COMMAND "ZOOM" "E" "ZOOM" "0.95X")
(setq wide (*1.88(getvar "viewsize"))) ;BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
(command"rotate" "all" "" "0,0" "-90")
(COMMAND "ZOOM" "E" "ZOOM" "0.95X") ;旋转视图以获得组立图总宽"wide"
(setq sal (ssget "X"))
(setq num 1) (setq n 0 ) (setq pu_counter 0) ;赋初值
(setq lse (ssget "X" '((0. "LINE"))))
(setq lna (entget (ssname lse 0))) ;(获取lse中的第一个名字)
(setq pti (cdr (assoc 10 lna)))
(setq ptx (car pti))
(setq pty (cadr pti)) ;取出被拆出的第一张图上某一点
(setq pti (list (+ wide ptx) (+(/ wide 2) pty))) ;为下面插入图框做准备
(while (>=(sslength sal) 1 )
(progn ;=========start prognl
(setq fen (entegt (ssname sal 0))) ;取"sal"集合中的第一个实体名
(setq fla (cdr (assoc 8 fen ))) ;取上述实体所在层名
(setq pu_list (append pu_list (list fla))) ;建层名表
(setq n(+ n 1)) ;取总层数
(setq sla (ssget "X"(list(cons 8 fla)))) ;讲所有"fla"层的实体加入集合"sla"中
(setq pt (* num wide))
(setq pt1 (list pt 0)) ;设置分解出实体放置点
(command "copy" sla "" "0,0" pt1) ;分解
(setq numl 0)
(repeat (sslength sla );--start repeat1 ;以"sla"选择集中对象的数量作为循环的次数
(progn;====start progn2
(setq nam (ssname sla numl))
(ssdel nam sal) ;删除"sla"选择集中的实体"nam"
(setq numl (+ numl 1))
);====end progn2 ;将被分解的实体从"sal"集合中清除
);--end repeat1
(setq num (+ num 1))
);==end progn1
);end while
(command "LAYER" "M" "41" "C" "green" "" "")
(ins_tk) ;调用自定意函数以插入图框
(COMMAND "ZOOM" "E" "ZOOM" "0.95X")
(setvar "cmdecho" oce)
(princ)
) ;*************************************************************************************************************** 展开
(defun c:be(/wo pti ptx pty lse lna oce wide sal n num fen fla sla pt tp1 num1 nam lname)
(setq oce (getvar "cmdecho")) ;自动拆分组立图
(setvar "cmdecho" 0 )
(setq wor (getstring"请确认文件中'group'处于'group off'状态(回车确认),否则立即按'ECS'键退出!"))
(if (= wor "" )(princ"正在拆分组立图,请稍后!谢谢!"))
(command"rotate" "all" "" "0,0" "90")
(COMMAND "ZOOM" "E" "ZOOM" "0.95X")
(setq wide (*1.88(getvar "viewsize"))) ;BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
(command"rotate" "all" "" "0,0" "-90")
(COMMAND "ZOOM" "E" "ZOOM" "0.95X") ;旋转视图以获得组立图总宽"wide"
(setq sal (ssget "X"))
(setq num 1) (setq n 0 ) (setq pu_counter 0) ;赋初值
(setq lse (ssget "X" '((0. "LINE"))))
(setq lna (entget (ssname lse 0))) ;(获取lse中的第一个名字)
(setq pti (cdr (assoc 10 lna)))
(setq ptx (car pti))
(setq pty (cadr pti)) ;取出被拆出的第一张图上某一点
(setq pti (list (+ wide ptx) (+(/ wide 2) pty))) ;为下面插入图框做准备
(while (>=(sslength sal) 1 )
(progn ;=========start prognl
(setq fen (entegt (ssname sal 0))) ;取"sal"集合中的第一个实体名
(setq fla (cdr (assoc 8 fen ))) ;取上述实体所在层名
(setq pu_list (append pu_list (list fla))) ;建层名表
(setq n(+ n 1)) ;取总层数
(setq sla (ssget "X"(list(cons 8 fla)))) ;讲所有"fla"层的实体加入集合"sla"中
(setq pt (* num wide))
(setq pt1 (list pt 0)) ;设置分解出实体放置点
(command "copy" sla "" "0,0" pt1) ;分解
(setq numl 0)
(repeat (sslength sla );--start repeat1 ;以"sla"选择集中对象的数量作为循环的次数
(progn;====start progn2
(setq nam (ssname sla numl))
(ssdel nam sal) ;删除"sla"选择集中的实体"nam"
(setq numl (+ numl 1))
);====end progn2 ;将被分解的实体从"sal"集合中清除
);--end repeat1
(setq num (+ num 1))
);==end progn1
);end while
(command "LAYER" "M" "41" "C" "green" "" "")
(ins_tk) ;调用自定意函数以插入图框
(COMMAND "ZOOM" "E" "ZOOM" "0.95X")
(setvar "cmdecho" oce)
(princ)
) ;*************************************************************************************************************** 展开
2个回答
展开全部
;-------------------------------------------------------------------------------------------
;有意学习lisp,可以加入我的学习CAD lisp群 202857076
;-------------------------------------------------------------------------------------------
(defun c:be(/ wo pti ptx pty lse lna oce wide sal n num fen fla sla pt tp1 num1 nam lname)
(setq oce (getvar "cmdecho")) ;自动拆分组立图
(setvar "cmdecho" 0 )
(setq wor (getstring "请确认文件中'group'处于'group off'状态(回车确认),否则立即按'ECS'键退出!"))
(if (= wor "" )(princ"正在拆分组立图,请稍后!谢谢!"))
(command "rotate" "all" "" "0,0" "90")
(COMMAND "ZOOM" "E" "ZOOM" "0.95X")
(setq wide (* 1.88 (getvar "viewsize"))) ;BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
(command "rotate" "all" "" "0,0" "-90")
(COMMAND "ZOOM" "E" "ZOOM" "0.95X") ;旋转视图以获得组立图总宽"wide"
(setq sal (ssget "X"))
(setq num 1) (setq n 0 ) (setq pu_counter 0) ;赋初值
(setq lse (ssget "X" '((0 . "LINE"))))
(setq lna (entget (ssname lse 0))) ;(获取lse中的第一个名字)
(setq pti (cdr (assoc 10 lna)))
(setq ptx (car pti))
(setq pty (cadr pti)) ;取出被拆出的第一张图上某一点
(setq pti (list (+ wide ptx) (+ (/ wide 2) pty))) ;为下面插入图框做准备
(while (>= (sslength sal) 1 )
(progn ;=========start prognl
(setq fen (entget (ssname sal 0))) ;取"sal"集合中的第一个实体名
(setq fla (cdr (assoc 8 fen ))) ;取上述实体所在层名
(setq pu_list (append pu_list (list fla))) ;建层名表
(setq n(+ n 1)) ;取总层数
(setq sla (ssget "X"(list ( cons 8 fla)))) ;讲所有"fla"层的实体加入集合"sla"中
(setq pt (* num wide))
(setq pt1 (list pt 0)) ;设置分解出实体放置点
(command "copy" sla "" "0,0" pt1) ;分解
(setq numl 0)
(repeat (sslength sla );--start repeat1 ;以"sla"选择集中对象的数量作为循环的次数
(progn;====start progn2
(setq nam (ssname sla numl))
(ssdel nam sal) ;删除"sla"选择集中的实体"nam"
(setq numl (+ numl 1))
);====end progn2 ;将被分解的实体从"sal"集合中清除
);--end repeat1
(setq num (+ num 1))
);==end progn1
);end while
(command "LAYER" "M" "41" "C" "green" "" "")
;(ins_tk) ;调用自定意函数以插入图框
(COMMAND "ZOOM" "E" "ZOOM" "0.95X")
(setvar "cmdecho" oce)
(princ)
) ;*****************************************
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询