Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

list issues for a popup list

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
smaher12
417 Views, 3 Replies

list issues for a popup list

How do I get this hatch pattern list to work in this dcl. Do I need to convert the pattern name to a number? I am pretty lost on what to do next on this.

 

(defun c:ww ()

(defun dfaults ()

  (if (= dia nil) (setq dia 1.0))  ;;; Dialog Menu Presets
  (setq names '("Ansi31" "Ansi32" "Ansi33"))
  (if dia (set_tile "dia" (rtos dia 2 1)))  ;;; Dialog Menu Callback
  (if selections (set_tile "selections" selections))

(start_list "selections") (mapcar 'add_list names) (end_list) ) ;end of dfaults (initiate) (setq p1 (getpoint "\nSpecify starting point: ")) (command "circle" p1 dia) (command "-HATCH" "p" names "1" "" p1 "") (princ) ) (defun initiate () (setq dcl_id (load_dialog "ww.dcl")) (if (not (new_dialog "ww" dcl_id)) (exit) ) (DFAULTS) (action_tile "dia" "(setq dia (distof $value))") (action_tile "selections" "(setq selections $value)") (action_tile "accept" "(done_dialog)") (action_tile "cancel" "(exit)") (start_dialog) (unload_dialog dcl_id) (princ) )

 

3 REPLIES 3
Message 2 of 4
pbejse
in reply to: smaher12

Quick hack

 

(defun c:ww ()
(defun dfaults ()
  (if (= dia nil) (setq dia 1.0))  ;;; Dialog Menu Presets
  (setq names '("Ansi31" "Ansi32" "Ansi33"))
  (if dia (set_tile "dia" (rtos dia 2 1)))  ;;; Dialog Menu Callback
  (set_tile "selections" (if selections selections
			   (setq selections "0")))

  (start_list "selections")
  (mapcar 'add_list names)
  (end_list)

) ;end of dfaults

 (initiate)
    (setq p1 (getpoint "\nSpecify starting point: "))
    (command "circle" p1 dia)
    (command "-HATCH" "p" (nth (atoi selections) names) "1" "" p1 "")
 (princ)
)

(defun initiate ()
  (setq dcl_id (load_dialog "ww.dcl"))
  (if (not (new_dialog "ww" dcl_id))
    (exit)
)

 (DFAULTS)
  (action_tile "dia" "(setq dia (distof $value))")
  (action_tile "selections" "(setq selections $value)")
  (action_tile "accept" "(done_dialog)")
  (action_tile "cancel" "(exit)")
   (start_dialog)
    (unload_dialog dcl_id)
     (princ)
 )

 

HTH

Message 3 of 4
smaher12
in reply to: pbejse

Genius pbejse! I was playing around with the following but was not getting the correct results. You saved the day. Thanks!

 

(setq patt (atof (get_tile "selections")))
   (setq patt (fix patt))
      (setq patt (nth patt names))

Message 4 of 4
pbejse
in reply to: smaher12


@smaher12 wrote:

Genius pbejse! I was playing around with the following but was not getting the correct results. You saved the day. Thanks!

 

 


You are welcome Smaher12, I can see your coding is progressing well, Keep it up.

 

pBe

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost