调用函数
请帮忙。这让我疯狂。为什么我不能在此例程中调用预定义函数(getcent1)?它可以在命令行中正常工作。
我错过了什么?我得到*无效选择*
(defun C:setvaluesCP (/)
(if (not (member matmixvalue '("Y" "N")))
(setq matmixvalue "Y")
);end if
(initget "Y N")
(setq choice72 (getkword (strcat "\nMaterial types - mixed?: <" matmixvalue ">: ")))
(if (not (member choice72 '("Y" "N")))
(setq choice72 mamixvalue)
(setq matmixvalue choice72)
);end if
;-----------------------------------------------------------------------------------
(defun getcentcp1 (/)
(setq regns (ssadd))
(progn
(princ "\n(A)luminium, stru(C)tural steel, (S)tainless steel")
(setq matype1 (getstring "\n1st material type: A,C or S"))
(setq regn1 (entsel "\nSelect 1st polyline: "))
(command "region" regn1 "")
(setq regn1 (entlast))
(setq fnCP1 "V:/AProps/secpropsCP1.mpr")
(command "massprop" regn1 "" "y" fnCP1)
(ssadd regn1 regns)
);end progn
(progn
(princ "\n(A)luminium, stru(C)tural steel, (S)tainless steel")
(setq matype2 (getstring "\n2nd material type: "))
(setq regn2 (entsel "\nSelect 2nd polyline: "))
(command "region" regn2 "")
(setq regn2 (entnext regn1))
(setq fnCP2 "V:/AProps/secpropsCP2.mpr")
(command "massprop" regn2 "" "y" fnCP2)
(ssadd regn2 regns)
);end progn
(command "union" regns "")
(princ)
);end defun
;------------------------------------------------------------------------------
(defun getcentcp2 (/)
(setq regns (ssadd))
(progn
(princ "\nSelect 1st polyline: ")
(setq regn1 (ssget '((0 . "Polyline"))))
(command "region" regn1 "")
(setq regn1 (entlast))
(setq fnCP1 "V:/AProps/secpropsCP1.mpr")
(command "massprop" regn1 "" "y" fnCP1)
(ssadd regn1 regns)
);end progn
(progn
(princ "\nSelect 2nd polyline: ")
(setq regn2 (ssget '((0 . "Polyline"))))
(command "region" regn2 "")
(setq regn2 (entnext regn1))
(setq fnCP2 "V:/AProps/secpropsCP2.mpr")
(command "massprop" regn2 "" "y" fnCP2)
(ssadd regn2 regns)
);end progn
(command "union" regns "")
(princ)
);end defun
;----------------------------------------------------------------------------------------------
(if (= choice72 "Y")
(getcentcp1)
(getcentcp2)
);end if
(princ)
);end defun
请检查返回的条目:
(setq regn1 (entsel "\nSelect 1st polyline: "))
(command "region" (car regn1) "") 此外,关于第二个函数:
你确定是关于旧类型的多段线,而不是新类型的多段线吗?
页:
[1]