tgibbo 发表于 2022-7-5 19:51:08

我的脚法差不多了

大家好
 
我差一点就成功了,但我看不出有什么错误
虽然我知道可能有很多其他的方法来实现我在这里尝试的,幽默我将你与这一个。
 
当做
 
托尼
 
这是我的DCL代码
 
tozafootingsRD
: dialog { label = "Insert a Footing " ;
: row {
: boxed_column { label = "Cylindrical Footing" ;
: boxed_column {            
: image { key = "cylinder" ; height = 8.0 ; width = 30.0 ;   
fixed_width = true; fixed_height = true;color = 0 ;}
      }
: boxed_column {
: edit_box { key = "rdc"; label = "Diameter of Footing"; edit_width = 6;
alignment = left ;allow_accept   =true;}
: edit_box { key = "rdd"; label = "Depth of Footing"; edit_width = 6;
alignment = left ;allow_accept   =true;}
               }
            }      
: spacer {}
    }
ok_cancel ;      
}
 
这是我的LISP代码
 
(defun C:tozafootingsRD (/ c1)
(setq dcl_id (load_dialog "tozafootingsRD.dcl"))
   (if (not (new_dialog "tozafootingsRD" dcl_id)
)
(exit)
)
(setq w (dimx_tile "cylinder")
       h (dimy_tile "cylinder")
    )
(start_image "cylinder")
(slide_image 0 0 w h "LBOLTS.sld")
(end_image)

(defun setVars (/ d1 d2)
(setq d1 (distof (get_tile "rdc"))
       d2 (distof (get_tile "rdd"))
    )   
)

(action_tile "accept" "(setVars) (done_dialog) (setq userclick T)")
(setq c1 (getpoint "\nPick Centre Top of footing "))
(command "cylinder" c1 (/ d1 2) (- d2))
(action_tile "cancel" "(done_dialog) (setq userclick nil)")       
(start_dialog)       
(unload_dialog dcl_id)
(princ)
)

Tharwat 发表于 2022-7-5 20:21:18

试试这个Tony
 

(defun c:Test(/ i d1 d2 c)
;; Tharwat 28.4.2015        ;;
(if
   (or (not (< 0 (setq i (load_dialog "tozafootingsRD.dcl"))))
       (not (new_dialog "tozafootingsRD" i))
       )
    (exit)
    (progn
      (start_image "cylinder")
      (slide_image 0 0 (dimx_tile "cylinder")
                     (dimy_tile "cylinder")
                                              "LBOLTS.sld")
      (end_image)
      (action_tile "accept" "(setq d1 (distof (get_tile \"rdc\"))
                                 d2 (distof (get_tile \"rdd\"))
                                 )
                              (done_dialog)")
      (action_tile "cancel" "(done_dialog)")
      (start_dialog)
      (unload_dialog i)
      ))
(if (and d1 d2(setq c (getpoint "\nPick Centre Top of footing :")))
   (command "_.cylinder" "_none" c (/ d1 2) (- d2))
   )
(princ)
)

tgibbo 发表于 2022-7-5 20:38:53

谢谢Tharwat我会试试的
 
当做
 
托尼

Tharwat 发表于 2022-7-5 21:03:34

 
不客气,托尼。
 
如果你有任何问题,请告诉我。
页: [1]
查看完整版本: 我的脚法差不多了