Jump to content

Reading a text file & categorising into a dialog box


Recommended Posts

Posted

I'm looking to make a script which will display different item descripts and display them with slides,

I'm creating a text file with all the info in but I'm not entirely sure on the best way to store to be able to grab the info and then categorise them from there,
I want to put them into categories of: Carriageway > Speed > System > Description then once the description is selected it to display each slide

 

my text document ATM is formatted as:

(("SINGLE CARRIAGEWAY" "30" "TRAFFIC SIGNALS" "2-WAY TRAFFIC SIGNAL APPROACH") (("TRAFFICLIGHT" "0.0") ("7011A" "15.0") ("517L" "30.0") ("518" "30.0") ("543" "45.0") ("7001" "60.0")))

(("SINGLE CARRIAGEWAY" "30" "STOP AND GO" "STOP AND GO APPROACH") (("STOP_GO" "0.0") ("7011B" "15.0") ("517L" "30.0") ("518" "30.0") ("7010F" "45.0") ("7001" "60.0")))

(("SINGLE CARRIAGEWAY" "30" "PRIORITY" "L PRIORITY APPROACH") (("DATUM" "0.0") ("516" "15.0") ("516-1" "15.0") ("517L" "30.0") ("518" "30.0") ("7001" "45.0")))

(("SINGLE CARRIAGEWAY" "30" "TWO WAY TRAFFIC" "TWO WAY APPROACH") (("DATUM" "0.0") ("517L" "15.0") ("518" "15.0") ("7001" "30.0")))

the first list being the info to categorise, then the second list has a list of each slide & number value to also display (any slide with duplicate numbers would display below the other in another slide window)


dialog display:

image.png.abf9ef561e504134a465108b13435e24.png

 

if there is anything similar to this i could read/ learn from or any guidance that would be much appreciated 

Posted (edited)

3 ideas.

 

You can do pop menu very easy and display slides that then call correct insert block command. Just make a custom mnu using notepad.

image.png.d6431eeee017b2dd315b71debaa33663.png

 

image.png.a514e86e6fc8af40186dc58a0f1a5e0d.png

 

You can also do custom dcl I have 2x2 3x3 4x4 etc they take a list of slide names and display then insert the block.

 

The last option unfortunately can not get any more is to have TTF fonts of hundreds of traffic signs. They are grouped according to state signs. AS TTF can be used with word etc also. The software came with a menu so displays all the signs by group. They traded as HFS fonts, I have tried to find them again.

 

image.png.e564d50fd914fc3ed7f283c025016bc4.png

 

image.png.70232c6061e225586a40d495f3a1c0e0.png

Edited by BIGAL
Posted

I need to display them in a specific way being the only issue, I don't necessarily need in import/ insert them into cad its more for just display/ info for specifics

 

I'd like to display each sign and below them specify a distance so it displays an approach for example a set of traffic lights with the correct meter markings, if possible id like to put all the info into one file rather than breaking it down into speed or carriageway type

Posted (edited)

Ok read the better explanation at TheSwamp. Ok 1 way very simple is to use my Multi radio buttons, the difference is you run a sequence of single dcl ending up with the images. 

image.png.7e8c53ca0bf8e47c6d3231df35ec54bf.png

(if (not AH:Butts)(load "Multi radio buttons.lsp")) ; loads the program if not loaded already
(setq ans (ah:butts 1 "V"   '("SELECT SPEED" "TRAFFIC SIGNALS" "STOP AND GO" "PRIORITY" "PRIORITY APPROACH" "TWO WAY TRAFFIC")))

 

 

You can do multi radio with 2 or more panels but you must preset can not be dynamic,  if say carriageway and speed is always asked then would use the 2 column version to start. I have seen a 5 column version.

image.png.3b5714bde31224791abc16408f01df2a.png

 

Multi radio buttons.lspMulti radio buttons 2col.lsp

 

 

 

 

Edited by BIGAL
Posted

Would it be possible to - from my DATA.ini file when the script is called to make 4 lists which grab all unique data (Carriageway, Speed, System & Desc) so I could use that data to populate dialog lists or radio buttons etc? then match that to the relevant data to the DATA file lists to then able to grab the slide & marker info

 

DATA.ini:

'(
(("SINGLE CARRIAGEWAY" "30" "TRAFFIC SIGNALS" "2-WAY TRAFFIC SIGNAL APPROACH") (("TRAFFICLIGHT" "0.0") ("7011A" "15.0") ("517L" "30.0") ("518" "30.0") ("543" "45.0") ("7001" "60.0")))
(("SINGLE CARRIAGEWAY" "30" "TRAFFIC SIGNALS" "3-WAY TRAFFIC SIGNAL APPROACH") (("TRAFFICLIGHT" "0.0") ("7011-1A" "15.0") ("517L" "30.0") ("518" "30.0") ("543" "45.0") ("7001" "60.0")))
(("SINGLE CARRIAGEWAY" "30" "TRAFFIC SIGNALS" "4-WAY TRAFFIC SIGNAL APPROACH") (("TRAFFICLIGHT" "0.0") ("7011-1B" "15.0") ("517L" "30.0") ("518" "30.0") ("543" "45.0") ("7001" "60.0")))
(("SINGLE CARRIAGEWAY" "30" "TRAFFIC SIGNALS" "PEDESTRIAN TRAFFIC SIGNAL APPROACH") (("TRAFFICLIGHT" "0.0") ("7011_2" "15.0") ("517L" "30.0") ("518" "30.0") ("543" "45.0") ("7001" "60.0")))
(("SINGLE CARRIAGEWAY" "30" "TRAFFIC SIGNALS" "TRAFFIC UNDER SIGNAL APPROACH") (("7021" "0.0") ("7001" "15.0")))
(("SINGLE CARRIAGEWAY" "30" "STOP AND GO" "STOP AND GO APPROACH") (("STOP_GO" "0.0") ("7011B" "15.0") ("517L" "30.0") ("518" "30.0") ("7010F" "45.0") ("7001" "60.0")))
(("SINGLE CARRIAGEWAY" "30" "PRIORITY" "L PRIORITY APPROACH") (("DATUM" "0.0") ("516" "15.0") ("516-1" "15.0") ("517L" "30.0") ("518" "30.0") ("7001" "45.0")))
(("SINGLE CARRIAGEWAY" "30" "PRIORITY" "L PRIORITY APPROACH") (("DATUM" "0.0") ("811" "15.0") ("811-1" "15.0") ("517R" "30.0") ("518" "30.0") ("7001" "45.0")))
(("SINGLE CARRIAGEWAY" "30" "TWO WAY TRAFFIC" "TWO WAY APPROACH") (("DATUM" "0.0") ("517L" "15.0") ("518" "15.0") ("7001" "30.0")))
(("SINGLE CARRIAGEWAY" "40" "TRAFFIC SIGNALS" "2-WAY TRAFFIC SIGNAL APPROACH") (("TRAFFICLIGHT" "0.0") ("7011A" "15.0") ("517L" "30.0") ("518" "30.0") ("543" "45.0") ("7001" "60.0")))
(("SINGLE CARRIAGEWAY" "40" "TRAFFIC SIGNALS" "3-WAY TRAFFIC SIGNAL APPROACH") (("TRAFFICLIGHT" "0.0") ("7011-1A" "15.0") ("517L" "30.0") ("518" "30.0") ("543" "45.0") ("7001" "60.0")))
(("SINGLE CARRIAGEWAY" "40" "TRAFFIC SIGNALS" "4-WAY TRAFFIC SIGNAL APPROACH") (("TRAFFICLIGHT" "0.0") ("7011-1B" "15.0") ("517L" "30.0") ("518" "30.0") ("543" "45.0") ("7001" "60.0")))
(("SINGLE CARRIAGEWAY" "40" "TRAFFIC SIGNALS" "PEDESTRIAN TRAFFIC SIGNAL APPROACH") (("TRAFFICLIGHT" "0.0") ("7011_2" "15.0") ("517L" "30.0") ("518" "30.0") ("543" "45.0") ("7001" "60.0")))
(("SINGLE CARRIAGEWAY" "40" "TRAFFIC SIGNALS" "TRAFFIC UNDER SIGNAL APPROACH") (("7021" "0.0") ("7001" "15.0")))
(("SINGLE CARRIAGEWAY" "40" "STOP AND GO" "STOP AND GO APPROACH") (("STOP_GO" "0.0") ("7011B" "15.0") ("517L" "30.0") ("518" "30.0") ("7010F" "45.0") ("7001" "60.0")))
(("SINGLE CARRIAGEWAY" "40" "PRIORITY" "L PRIORITY APPROACH") (("DATUM" "0.0") ("516" "15.0") ("516-1" "15.0") ("517L" "30.0") ("518" "30.0") ("7001" "45.0")))
(("SINGLE CARRIAGEWAY" "40" "PRIORITY" "L PRIORITY APPROACH") (("DATUM" "0.0") ("811" "15.0") ("811-1" "15.0") ("517R" "30.0") ("518" "30.0") ("7001" "45.0")))
(("SINGLE CARRIAGEWAY" "40" "TWO WAY TRAFFIC" "TWO WAY APPROACH") (("DATUM" "0.0") ("517L" "15.0") ("518" "15.0") ("7001" "30.0")))
)

 

2 hours ago, BIGAL said:

Ok read the better explanation at TheSwamp. Ok 1 way very simple is to use my Multi radio buttons, the difference is you run a sequence of single dcl ending up with the images. 

image.png.7e8c53ca0bf8e47c6d3231df35ec54bf.png

(if (not AH:Butts)(load "Multi radio buttons.lsp")) ; loads the program if not loaded already
(setq ans (ah:butts 1 "V"   '("SELECT SPEED" "TRAFFIC SIGNALS" "STOP AND GO" "PRIORITY" "PRIORITY APPROACH" "TWO WAY TRAFFIC")))

 

 

You can do multi radio with 2 or more panels but you must preset can not be dynamic,  if say carriageway and speed is always asked then would use the 2 column version to start.

image.png.3b5714bde31224791abc16408f01df2a.png

 

Multi radio buttons.lsp 3.38 kB · 43 downloads Multi radio buttons 2col.lsp 4.29 kB · 15 downloads

 

 

 

 

 

Posted (edited)

Ok started to put something together ends up with a list that can maybe be found in your big master list.

 

image.png.9a9006e68fccafacb0a43fb2ad4b2f3e.png

 

(if (not ah:buttscol3)(load "Multi Radio buttons 3col.lsp"))
(setq but1 1)
(setq but2 1)
(setq but3 1)
(setq lst1 (list "Select TYPE" "SINGLE CARRIAGEWAY" "DUAL CARRIAGEWAY" "SINGLE+LEFT" "SINGLE+RIGHT" "DUAL CARRIAGEWAY+LEFT" "DUAL CARRIAGEWAY+rIGHT"))
(setq lst2 (list "Select SPEED" "30" "40" "45" "50"))
(setq lst3 (list "Select SIG TYPE " "TRAFFIC SIGNALS" "STOP AND GO" "PRIORITY" "TWO WAY TRAFFIC"))
(ah:buttscol3 but1 but2 but3 "Please choose" lst1 lst2 lst3 "H")
(setq lst '())
(setq lst (cons (list (nth but1 lst1)(nth but2 lst2)(nth but3 lst3)) lst))

 Not sure where to go next 

 

Need say a few combos to understand have the 1st 3 worked out when get to 4th ? 

("DUAL CARRIAGEWAY" "45" "STOP AND GO")

Multi radio buttons 3col.lsp

Edited by BIGAL
Posted

thank you, someone linked me to one of Lee Macs scripts which worked perfect for what m initial aim was

 

image.thumb.png.cf9a8e8af103746b7482525440928d61.png

 

so I've ended up with two files to make this work easier, one which controls the list of items for the dialog, and other which stores the "description" to be able to connect both lists as well as the slide info and marker info

 

The only issue I'm having ATM is getting it work within a action_tile

 

(defun c:SAPPROACH (/ *error* dch dcl des lst rtn)

  (defun *error* (msg)
    (if (= 'file (type des))
      (close des)
    )
    (if (< 0 dch)
      (unload_dialog dch)
    )
    (if (and (= 'str (type dcl)) (findfile dcl))
      (vl-file-delete dcl)
    )
    (if (and msg (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*")))
      (princ (strcat "\nError: " msg))
    )
    (princ)
  )

  (setq lst (load (findfile "DATA\\SAPPROACHES.ini")))

  (if
    (and
      (setq fn (findfile "MACROS\\DIALOGS\\APPROACH.dcl"))
      (setq dlg_id (load_dialog fn))
      (new_dialog "SARRAY" dlg_id)
    )
    (progn
      (setq rtn '(0 0 0))
      ;(LM:dcld:action '( "speed-list" "sys-list" "desc-list") 'lst 'rtn)
      (action_tile "desc-list" "(SLIDERESET)(SLIDEIMAGE (caddr (LM:dcld:getitems rtn lst)))")
      (if (= 1 (start_dialog))
        (princ (caddr (LM:dcld:getitems rtn lst)))
      )
    )
  )
  (*error* nil)
  (princ)
)

 

Link to Lee Macs script: http://lee-mac.com/listtiledependency.html

21 hours ago, BIGAL said:

Ok started to put something together ends up with a list that can maybe be found in your big master list.

 

image.png.9a9006e68fccafacb0a43fb2ad4b2f3e.png

 

(if (not ah:buttscol3)(load "Multi Radio buttons 3col.lsp"))
(setq but1 1)
(setq but2 1)
(setq but3 1)
(setq lst1 (list "Select TYPE" "SINGLE CARRIAGEWAY" "DUAL CARRIAGEWAY" "SINGLE+LEFT" "SINGLE+RIGHT" "DUAL CARRIAGEWAY+LEFT" "DUAL CARRIAGEWAY+rIGHT"))
(setq lst2 (list "Select SPEED" "30" "40" "45" "50"))
(setq lst3 (list "Select SIG TYPE " "TRAFFIC SIGNALS" "STOP AND GO" "PRIORITY" "TWO WAY TRAFFIC"))
(ah:buttscol3 but1 but2 but3 "Please choose" lst1 lst2 lst3 "H")
(setq lst '())
(setq lst (cons (list (nth but1 lst1)(nth but2 lst2)(nth but3 lst3)) lst))

 Not sure where to go next 

 

Need say a few combos to understand have the 1st 3 worked out when get to 4th ? 

("DUAL CARRIAGEWAY" "45" "STOP AND GO")

Multi radio buttons 3col.lsp 4.84 kB · 2 downloads

 

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