Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Mentor
smaher12
Posts: 191
Registered: ‎11-20-2011
Message 1 of 4 (207 Views)
Accepted Solution

list issues for a popup list

207 Views, 3 Replies
01-02-2014 06:19 PM

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) )

 

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

*Expert Elite*
pbejse
Posts: 2,500
Registered: ‎11-24-2009
Message 2 of 4 (198 Views)

Re: list issues for a popup list

01-02-2014 07:42 PM 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

Mentor
smaher12
Posts: 191
Registered: ‎11-20-2011
Message 3 of 4 (191 Views)

Re: list issues for a popup list

01-02-2014 08:05 PM 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))

*Expert Elite*
pbejse
Posts: 2,500
Registered: ‎11-24-2009
Message 4 of 4 (188 Views)

Re: list issues for a popup list

01-02-2014 08:09 PM 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

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.