Hippe013,非常感谢你的建议。我试图将它们合并到代码中(我忘了添加以检查变量是否已创建,谢谢!)。比格尔,那个工具栏太棒了!李,谢谢你提供关于恩塞尔和汽车的信息。然而,我一直在搞乱代码,现在我得到了错误”;错误:错误的COND语法:(ENT((…)( ... ) ( ... )) (( ... ) ( ... )) (( ... ) ( ... ) ( ... )))“而且代码不会加载。我对LISP还是很陌生,所以我不知道如何在无法加载的情况下调试代码。我的新代码如下:
- (defun CheckorGetSurface ()
- (while
- (not
- (and
- (setq SurfaceDefaultAdd
- (car
- (entsel
- "\rSelect the Main Surace you to be the default: "
- )
- )
- )
- (= "AECC_TIN_SURFACE"
- (cdr (assoc 0 (entget SurfaceDefaultAdd)))
- )
- )
- )
- )
- )
- (defun c:makeparkingcurb (/ ent ent1 *error*)
- (defun *error* (msg)
- (if (not
- (member msg '("Function cancelled" "quit / exit abort"))
- )
- (princ (strcat "\nError: " msg))
- )
- (princ)
- )
- (if (not SurfaceDefaultAdd)
- (CheckorGetSurface)
- )
- (if (not *offsetdistans*)
- (setq *offsetdistans* 0.5)
- )
- (if (not *offsetheightans*)
- (setq *offsetheightans* 0.5)
- )
- (setq whilestop t)
- (while whilestop
- (initget 1 "Settings eXit")
- (setq ent (entsel
- "\n Select the feature line you want to offset [settings eXit]: "
- )
- )
- (cond
- ent
- ((= ent "Settings")
- (setq *offsetdistans*
- (cond
- ((getreal "\nOffset Distance" "" (*offsetdistans*) ":")
- )
- (*offsetdistans*)
- )
- )
- (setq *offsetheightans*
- (cond
- ((getreal "\nOffset Distance" "" (*offsetheightans*) ":")
- )
- (*offsetheightans*)
- )
- )
- )
- ((= ent "Settings")
- (setq whilestop nil))
- ((setq entlist (entget ent))
- (cond (= "AECC_FEATURE_LINE" (cdr (assoc 0 entlist)))
- (command "._OffsetFeature" *offsetdistans* ent)
- (princ "\nSpecify side to offset: ")
- (command pause *offsetheightans* "")
- (setq ent1 (entlast))
- (command "._AddSurfaceBreaklines" SurfaceDefaultAdd ent1 "")
- )
- (princ "\nNot a feature line")
- )
- )
- )
- (princ "\nNothing selected")
- (princ)
- )
|