Jump to content

Recommended Posts

Posted

After making the multi lisps always thought has to be a simple way to make dcl code from a dwg, so this is a real rough 1st go for multi radio buttons, it makes a dcl, but further down the track will do make dcl or lisp code. 

 

The example uses a block with 1 attribute, the attribute holds the label to be used, in future will hard code the block name so Radio, Toggle, Edit etc are auto implied in code. 

 

Just select dcl dialog name, heading label, then the buttons . You can test using "Test" 

 

In the multi radio buts I do a loop to work out which button has been selected but may do a cond instead as easier to understand.

 

Appreciate any comments at this stage as I said very much 1st go.

 

; make dcl from blocks
; By AlanH Nov 2022

(defun wow ( /)
(setq fo (open (setq fname "d:\\acadtemp\\dcl2lisp.dcl") "W"))
(setq colrow (strcase (getstring "\nRow or Col R C")))
(setq dclname (cdr (assoc 1 (entget (car  (entsel "\npick dcl name text"))))))
(setq dclhead (cdr (assoc 1 (entget (car  (entsel "\npick heading text"))))))
(prompt "Pick the block objects ")
(setq ss (ssget '((0 . "INSERT"))))
(write-line (strcat dclname " : dialog {") fo)
(write-line (strcat  "Label = " "\"" dclhead "\"" " ;") fo)
(write-line ": row {" fo)
(if (= colrow "C")
(write-line ": boxed_radio_column {" fo)
(write-line ": boxed_radio_row {" fo)
)
(setq x 1)
(repeat (setq k (sslength ss))
(setq obj (vlax-ename->vla-object (ssname ss (setq k (- k 1)))))
(setq atts (vlax-invoke obj 'Getattributes))
(repeat (setq j (length atts))
(write-line " : radio_button	{" fo)
(write-line  (strcat "key = "  "\"" "Rb" (rtos x 2 0)  "\"" " ;") fo)
(write-line  (strcat "label = " "\"" (vla-get-textstring (nth (setq j (1- j)) atts)) "\"" " ;") fo)
(write-line "	}" fo)
(write-line "spacer_1 ;" fo)
(setq x (1+ X))
)
)
(write-line "}" fo)
(write-line "}" fo)
(write-line "spacer_1 ;" fo)
(write-line "ok_cancel ;" fo)
(write-line "}" fo)
(close fo)
)
(wow)

(defun c:test ( / )
(defun butpressed ( )
(alert "various ways of checking button presed")
)

(setq dcl_id (load_dialog fname))
(if (not (new_dialog dclname dcl_id) )
(exit)
)
(action_tile "accept" "(butpressed ) (done_dialog)")
(start_dialog)
(unload_dialog dcl_id)

(princ)
)

 

dwg to dcl.dwg

  • Thanks 1
Posted

Looks interesting Bigal. Could be handy for simple '1-dimensional' dialogs. I usually first draw my dialogs in AutoCad and when I'm happy with the design I start coding it in my lisp routine. And after that some fine tuning to make sure things don't irritate me like they don't align the way I want it. Wished Autodesk added a dcl design center like the one in VBA.

🐉

Posted (edited)

Yes the Forms in VBA are a much better way to work similar to Opendcl. I have not gone down the Opendcl direction as doing work for clients its one more add on to make sure is loaded, have enough problems making sure what I supply is installed as simple as possible. The DCL is really old code and not updated. With the push to Visual Studio, you would think opportunity is there to do a DCL extension.

 

Will do version 2 ask dcl or lisp, then say edit box. I was thinking use a block again so get label but use X scale for width , this way can have various widths.

Edited by BIGAL
Posted

I did once make a start with exactly what you're doing right now, but decided did not have enough time to see this tru. It would involve making a standard dedicated drawing with symbols ect. and using special polylines for row and columns and then place symbols inside these polylines and then the lot would have to be sorted just like any lisp expression but then from outside to inside. But then I thought, nah, I type in my dialogs directly inside my routines, just as fast. 

Posted

Thats why may do as simple sequence for experienced programmers as a 1/2 step as you suggest rather than write the lines of code but copy and paste the sections together. You know want these as a row or column.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...