Author Topic: Routine not working, please help.  (Read 4261 times)

0 Members and 1 Guest are viewing this topic.

Bhull1985

  • Guest
Routine not working, please help.
« on: September 26, 2013, 11:12:27 AM »
I am having a tremendous amount of trouble having a simple slide image appearing in my dcl
I've tried everything I can think of and have not been able to get the image to preview or show at all
Even though I've got a direct path to it
and have seen this SAME CODE work in another routine, which is successful in having the slides preview.

I'm not even going to worry about the dynamic blocks portion that will be included into this lisp at some point, just right now I want my list_boxes to populate correctly as well as having the slide preview update with each selection
A challenge for a guru surely, but this is impossible for me. I've spent over 20 hours this week and haven't had one slide appear.
If someone would be so kind as to show me what i'm doing wrong I would GREATLY appreciate the chance to be able to MOVE FORWARD WITH THIS.
« Last Edit: October 01, 2013, 09:52:57 AM by Bhull1985 »

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: Routine not working, please help.
« Reply #1 on: September 26, 2013, 11:32:11 AM »
I am no guru but to I can help in getting your code to viewed easier by the other members.

Modify your post and paste your code between code tags
[ code] Paste your Code here [ /code]

You can get the code tags by hitting the above button.   Post both lisp and your dcl code.


I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

Bhull1985

  • Guest
Re: Routine not working, please help.
« Reply #2 on: September 26, 2013, 11:38:02 AM »
Code: [Select]

(defun c:test ( / *error* MakeList key lst dc Make Models Model Year flag path blox)

(vl-load-com)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ERROR HANDLER;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  (defun *error* ( msg ) ;;
    (and dc (unload_dialog dc)) ;;
    (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") ;;
        (princ (strcat "\n** Error: " msg " **"))) ;;
    (princ) ;;
  ) ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;PATH VARIABLE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq path "Y:\\bhull\\_Lispl3ox\\_Untestecl\\") ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;BEGINNING OF LIST lst;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 

   (setq lst (list nil "Pressure_Reducing_Regulator_w_External_Tap" "Pressure_Reducing_Regulator" "Gate_Valve_w_Bleed_Valve_Piston_Act" "Gate_Valve_w_Bleed_Valve"

"Flgd_Pressure_Reducing_Regulator" "Flgd_Gate_Valve_w_Bleed_Valve_Piston_Act" "Flgd_Gate_Valve_w_Bleed_Valve" "Flgd_Ball_Valve_w_Bleed_Valve" "Ball_Valve_w_Bleed_Valve")
         Slide1$ (nth 1 lst)
         Slide2$ (nth 2 lst)
         Slide3$ (nth 3 lst)
         Slide4$ (nth 4 lst)
         Slide5$ (nth 5 lst)
         Slide6$ (nth 6 lst)
         Slide7$ (nth 7 lst)
         Slide8$ (nth 8 lst)
         Slide9$ (nth 9 lst)
         Slide10$ (nth 10 lst)
   );setq



  (setq Data

     '(

       ("Valves"      . (("_ANGLE_VALVE"     . ("Angle Valve" "Angle Control Valve" "Flanged Angle Valve" "Flanged Angle Control Valve"))
                          ("_BACKPRESSURE_REGULATOR"     . ("Backpressure Regulator" "Flanged Backpressure Regulator" "Backpressure Regulator w External Tap"))
                          ("_BALL_VALVE"     . ("CV with Hand Actuator" "Diaphragm Actuated CV" "Three Way Control Valve- HO"))
                          ("_BLEED_VALVES"     . ("Double Acting-Air to Close and Open" "Piston Operated Ball Valve" "Piston Operated Three-Way Valve" "Piston Operated Valve"))
                          ("_BUTTERFLY_ON_OFF_VALVE"     . ("Butterfly On-Off Valve" "Flanged Butterfly On-Off Valve" "Butterfly Valve" "Flanged Butterfly Valve" "Butterfly

Control Valve - HO" "Flanged Butterfly Control Valve - HO" "Butterfly Control Valve" "Flanged Butterfly Control Valve"))
                          ("_CHECK_VALVE"       . ("Angle Control Valve" "Three-Way Control Valve-HO" "Four-Way Solenoid Valve"))
                          ("_DIAPHRAGM_AND_HAND_ACT_GV"       . ("Motor Operated Valve" "Two-Way Motor Operated Ball Valve"))
                          ("_FOUR_WAY_VALVES"       . ("Motor Operated Valve" "Two-Way Motor Operated Ball Valve"))
                          ("_GATE_VALVES"       . ("Motor Operated Valve" "Two-Way Motor Operated Ball Valve"))
                          ("_GLOBE_VALVE"       . ("Globe Valve" "Globe Control Valve" "Flanged Globe Valve" "Flanged Globe Control Valve"))
                          ("_MOTOR_OPERATED_VALVE"       . ("Motor Operated Valve" "Two-Way Motor Operated Ball Valve"))
                          ("_NEEDLE_VALVES"       . ("Motor Operated Valve" "Two-Way Motor Operated Ball Valve"))
                          ("_PLUG_VALVE"       . ("Motor Operated Valve" "Two-Way Motor Operated Ball Valve"))
                          ("_PRESSURE_REDUCING_REGULATOR"       . ("Pressure Reducing Regulator" "Flanged Pressure Reducing Regulator" "Pressure Reducing Regulator w External

Tap"))
                          ("_SOLENOID_VALVE"       . ("Motor Operated Valve" "Two-Way Motor Operated Ball Valve"))
                          ("_THREE_WAY_VALVE"       . ("Motor Operated Valve" "Two-Way Motor Operated Ball Valve"))
                          ("_VALVES_withBLEED_VALVES"       . ("Motor Operated Valve" "Two-Way Motor Operated Ball Valve"))))
 
       ("Instruments"      . (("Local Panel"       . ("_LOCAL_PANEL_MOUNTED_PROGRAMMABLE_LOGIC_CONTROL" "_local_panel_mounted_instrument"

"_local_panel_mounted_computer_function" "_local_mounted_programmable_logic_control" "_LOCAL_MOUNTED_INSTRUMENT" "_local_mounted_computer_function"

"_behind_local_panel_instrument"))
                          ("Control Panel"      . ("_control_panel_mounted_programmable_logic_control" "_control_panel_mounted_instr" "_control_panel_mounted_computer_function"

"_behind_control_panel_mounted_programmable_logic_control" "_behind_control_panel_instrument"))
                          ("Shared Display"  . ("_shared_display_with_instrument_bubble"))))

       ("Stamps"     . (("Issued For:"       . ("Flgd Angle Valve" "Flgd Four-Way Valve" "Flgd Three-Way Ball Valve" "Flgd Three-Way Valve"))
                          ("Note:"  . ("Flgd Backpressure Regulator" "Flgd Pressure Reducing Regulator" "Flgd Backpressure Regulator w External Tap" "Flgd Pressure Reducing

Regulator w External Tap"))
                          ("Other"  . ("Fldg Ball Type Control Valve" "Flgd Two Way Motor Operated Ball Vlv" "Flgd Piston Op Ball Valve"))
                          ("Butterfly Valves"  . ("Flgd Butterfly CV-HO" "Flgd Butterfly CV" "Flgd Butterfly On-Off Valve"))
                          ("Motor Valves"  . ("Flgd Motor Operated Ball Valve" "Flgd Motor Operated Valve" "Right Flgd Motor Operated Valve" "Left Flgd Motor Operated

Valve"))))
      )
  )


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;END OF LIST lst;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;BEGIN SUBFUNCTIONS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun MakeList ( key l )
    (start_list key)
    (mapcar (function add_list) l)
    (end_list)
  )



(defun slide ( key file )
    (if (setq file (findfile file))
      (progn
        (start_image key)
        (fill_image 0 0 (dimx_tile key) (dimy_tile key) 0)
        (slide_image 1 1 (- (dimx_tile key) 2) (- (dimy_tile key) 2) file)
        (end_image)
      )
    )
  ) 



(defun my-block-files (path /) ;;
(setq lst ;;
(vl-directory-files path  "*.dwg" 1)) ;;
)


(defun updateimage (sldname key)
(setq width (dimx_tile key))
(setq height (dimy_tile key))
(start_image key)
;(fill_image 1 1 width height 1)
(slide_image 1 1 width height sldname)
(end_image)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;END OF FUNCTIONS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;BEGIN MAIN LOOP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  (cond (  (<= (setq dc (load_dialog "Example.dcl")) 0) ;;
;;
           (princ "\n** DCL File not Found **")) ;;
;;
        (  (not (new_dialog "test" dc)) ;;
;;
           (princ "\n** Dialog could not be loaded **")) ;;
;;
        (t

           (MakeList "make"  (mapcar (function car) Data))
           (setq Make  (atoi (set_tile "make" "0")))
             
           (MakeList "model" (mapcar (function car) (cdar Data)))
           (setq Model (atoi (set_tile "model" "0")))

           (MakeList "year"  (cdadar Data))
           (setq Year  (atoi (set_tile "year" "0")))

;    (MakeList "blox" (my-block-files path))
           (setq blox (my-block-files path))


(setq key "sld")

(slide "sld" (strcat path (nth (atoi (nth year blox)) lst) ".sld"))

(updateimage (nth year blox) key)


           (action_tile "make"  "(MakeList \"model\"
                                   (mapcar (function car)
                                     (setq Models (cdr (nth (setq Make (atoi $value)) Data)))))
                                 (set_tile \"model\" \"0\")
                                 (MakeList \"year\" (cdar Models))
                                 (setq Year (atoi (set_tile \"year\" \"0\")))")

           (action_tile "model" "(MakeList \"year\" (cdr (nth (setq Model (atoi $value)) Models)))
                                 (setq Year (atoi (set_tile \"year\" \"0\")))")

           (action_tile "year" "(slide \"sld\" (strcat path (nth (atoi $value) lst) \".sld\"))")





           (setq flag (start_dialog) dc (unload_dialog dc))

           (if (= 1 flag)
             (progn
(updateimage (nth year blox) key)
               (setq Selection (nth Make Data)
                     Make      (car Selection)
                     Models    (nth Model (cdr Selection))
                     Model     (car Models)
                     Year      (nth Year  (cdr Models)))

              (command "_insert" year pause "" "" pause))

             (princ "\n*Cancel*"))))
  (princ))

           


;;;;;;;end of lisp;;;;;;;;;;;
;;;;;;;;;;start of dcl;;;;;;;;;;;;;;;

lst : list_box { alignment = centered; fixed_width = true; width = 25; }
lst2 : list_box { alignment = centered; fixed_width = true; width = 40; }

test : dialog { label = "Dynamic Valve Selection"; spacer;
  : row { spacer;


    : lst { key = "make" ; label = "Class" ; } spacer;
    : lst { key = "model"; label = "Type"; } spacer;
    : lst2 { key = "year"; label = "Specification"; } spacer;

    : boxed_column { label = "Preview";

      : image { key = "sld"; height = 8; fixed_height = true;
                width = 30; fixed_width = true; color = 0; aspect_ratio = 1;
                is_enabled = true; is_tab_stop = false;
              }
    }
  }
  spacer;
  ok_cancel;
}



There it is
Some of the code is useless, i'm aware, but have been trying so many different things to get this to work...nothing works

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: Routine not working, please help.
« Reply #3 on: September 26, 2013, 11:42:59 AM »
Okay couple of other suggestion.  For when I am debugging code, I sprinkle a couple of watches to local variables throughout the code and once the code has finished running,  I check to see the results to see if it meets my expectations. 

Sorry I got interrupted. 
First Are you sung vlide editor?  IF so you, you would highlight the variable > right click and select ADD WATCH.

« Last Edit: September 26, 2013, 12:02:43 PM by Krushert »
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

Bhull1985

  • Guest
Re: Routine not working, please help.
« Reply #4 on: September 26, 2013, 11:52:26 AM »
Yes I've been using the vlide quite a lot but I need someone who can tell me what i'm doing wrong in the code
thought I do appreciate your attentions, I need to find out what i'm doing incorrectly else i'll never learn the stuff nor have my slide preview

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Routine not working, please help.
« Reply #5 on: September 26, 2013, 11:54:04 AM »
Got it to work, see attached.
Note that I commented out some code.
There is a problem with this
Code: [Select]
(updateimage (nth year blox) key)probably not creating the proper file name.
I've reached the age where the happy hour is a nap. ()
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Bhull1985

  • Guest
Re: Routine not working, please help.
« Reply #6 on: September 26, 2013, 01:13:59 PM »
You are the MAN!
Thanks so much, I'm going to look now..

Bhull1985

  • Guest
Re: Routine not working, please help.
« Reply #7 on: September 26, 2013, 01:26:31 PM »
So In my action tile for "year" I should save the value of the tile and pass that back to the update image function?
That's where I believe the (atoi $value) would be necessary except that I keep getting a stringp error when it's passed back and attempts to fill the slide image using the "file" variable
I'm wondering how I can have the 3rd listbox pass it's value as a string back to the slide tile so that it can wipe and re-fill the slide tile each time an item in the 3rd list_box is selected.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Routine not working, please help.
« Reply #8 on: September 26, 2013, 02:35:08 PM »
The $value returned for year will be an index of the following:
("Angle Valve" "Angle Control Valve" "Flanged Angle Valve" "Flanged Angle Control Valve")
So your intent was to use a path :
"Y:\\bhull\\_Lispl3ox\\_Untestecl\\" plus "Angle Valve" plus ".sld"

Action "(slide \"sld\" (strcat path (nth (atoi $value) lst) \".sld\"))"
(atoi $value) -> 0
(nth 0 lst) ->  Filename.dwg
(strcat path (nth 0 lst) ".sld")  -> Filename.dwg.sld
I've reached the age where the happy hour is a nap. ()
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Routine not working, please help.
« Reply #9 on: September 26, 2013, 03:26:09 PM »
So you need to create a list of sld files or strip off the ".dwg" if you have slides with names to match.

I've reached the age where the happy hour is a nap. ()
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Bhull1985

  • Guest
Re: Routine not working, please help.
« Reply #10 on: September 26, 2013, 05:01:50 PM »
Thank you CAB
Many 'kudos' for helping me with this, if only I could give them here :)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Routine not working, please help.
« Reply #11 on: September 26, 2013, 11:25:51 PM »
Glad to help.
I'm off for the week end but if you get stuck someone will step in. 8)
I've reached the age where the happy hour is a nap. ()
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Bhull1985

  • Guest
Re: Routine not working, please help.
« Reply #12 on: October 01, 2013, 01:24:51 PM »
Hi, I haven't quite been able to get this working properly. I've been attempting to add a lot of code to a working routine by lee mac
There's this:
Code: [Select]
** Error: bad argument type: consp nil **That occurs when an item in the 2nd list box is the first user selection
And there's a problem stopping the slide preview which is supposed to operate off the final list box's selection and display a .sld preview


I just do not know how to construct a list of the slides that would make the value of the last selection in the 3rd list box display the correct slide, even though I do have the slides made and in a folder. The $value for the variable "year" (still from Lee's variable choices) will return an integer that will supply the (nth) function and pull from a list of slides, but there are over 100 slides and the $value variable will just be 1-10 because ten is the max amount of choices from any "model"(which populates the list that the user will select the slide (and later, block) from) and it's resultant list and 3rd list_box choices "year". Thusly ...i'm fearing it would only be able to return up to 10 slides from my slide list which should have over 100.
This is the issue that needs to be resolved with this routine if anyone has a suggestion please inform
Code: [Select]
  (cond (  (<= (setq dc (load_dialog "Example.dcl")) 0)

           (princ "\n** DCL File not Found **"))

        (  (not (new_dialog "test" dc))

           (princ "\n** Dialog could not be loaded **"))

        (t

           (MakeList "make"  (mapcar (function car) Data))
           (setq Make  (atoi (set_tile "make" "0")))
             
           (MakeList "model" (mapcar (function car) (cdar Data)))
           (setq Model (atoi (set_tile "model" "0")))

           (MakeList "year"  (cdadar Data))
           (setq Year  (atoi (set_tile "year" "0")))

;    (MakeList "blox" (my-block-files path))
           (setq blox (my-block-files path))

;(set_tile "sld" (nth Year lst))

(setq key "sld")
(slide "sld" (strcat "Ball_Valve_w_Bleed_Valve" ;|(strcat path (nth (atoi (nth year blox)) lst)|; ".sld"))



           (action_tile "make"  "(MakeList \"model\"
                                   (mapcar (function car)
                                     (setq Models (cdr (nth (setq Make (atoi $value)) Data)))))
                                 (set_tile \"model\" \"0\")
                                 (MakeList \"year\" (cdar Models))
                                 (setq Year (atoi (set_tile \"year\" \"0\")))")

           (action_tile "model" "(MakeList \"year\" (cdr (nth (setq Model (atoi $value)) Models)))
                                 (setq Year (atoi (set_tile \"year\" \"0\")))")

           (action_tile "year" "(setq sld (atoi $value))(updateimage year sld)")





           (setq flag (start_dialog) dc (unload_dialog dc))

           (if (= 1 flag)
             (progn
(updateimage (nth year blox) sld)
               (setq Selection (nth Make Data)
                     Make      (car Selection)
                     Models    (nth Model (cdr Selection))
                     Model     (car Models)
                     Year      (nth Year  (cdr Models)))

              (command "_insert" year pause "" "" pause))

             (princ "\n*Cancel*")
     )))
  (princ))

         

and the data list
Code: [Select]
(setq Data

     '(

       ("Valves"      . (("Angle Valves"     . ("Angle Valve" "Angle Control Valve" "Flanged Angle Valve" "Flanged Angle Control Valve"))
                          ("Backpressure Regulators"     . ("Backpressure Regulator" "Flanged Backpressure Regulator" "Backpressure Regulator w External Tap"))
                          ("Ball Valves"     . ("Two-Way Motor Operated Ball Valve" "Double Acting Piston Valve - Air Operated" "Piston Operated Ball Valve" "Flanged Motor Operated Ball Valve" "Flanged Piston Operated Ball Valve"

"Flanged Ball Type Control Valve" "Flanged Double Acting Piston Valve - Air Operated" "Flanged Ball Valve" "Flanged Ball Valve w Bleed Valve" "Flanged Three-Way Ball Valve"))
                          ("Bleed Valves"     . ("Ball Valve w Bleed Valve" "Gate Valve w Bleed Valve" "Flanged Ball Valve w Bleed Valve" "Flanged Gate Valve w Bleed Valve" "Flanged Gate Valve w Bleed Valve and Piston Actuator" "Gate

Valve w Bleed Valve and Piston Actuator"))
                          ("Butterfly On-Off Valve"     . ("Butterfly On-Off Valve" "Flanged Butterfly On-Off Valve" "Butterfly Valve" "Flanged Butterfly Valve" "Butterfly Control Valve - HO" "Flanged Butterfly Control Valve - HO"

"Butterfly Control Valve" "Flanged Butterfly Control Valve"))
                          ("Check Valves"       . ("Check Valve" "Flanged Check Valve"))
                          ("Dia and Hand Act Control Valves"       . ("Control Valve w Hand Actuator" "Flanged Control Valve w Hand Actuator" "Diaphragm Actuated Control Valve" "Flanged Diaphragm Actuated Control Valve"))
                          ("Four Way Valves"       . ("Four Way Valve" "Flanged Four Way Valve"))
                          ("Gate Valves"       . ("Gate Valve" "Flanged Gate Valve" "Right Flanged Gate Valve" "Left Flanged Gate Valve" "Piston Operated Gate Valve" "Flanged Piston Operated Gate Valve"))
                          ("Globe Valves"       . ("Globe Valve" "Flanged Globe Valve" "Globe Control Valve" "Flanged Globe Control Valve"))
                          ("Motor Operated Valves"       . ("Motor Operated Valve" "Flanged Motor Operated Valve" "Two-Way Motor Operated Ball Valve" "Flanged Motor Operated Ball Valve" "Right Flanged Motor Operated Valve" "Left Flanged

Motor Operated Valve"))
                          ("Needle Valves"       . ("Needle Valve" "Small Needle Valve" "Flanged Needle Valve"))
                          ("Plug Valves"       . ("Plug Valve" "Flanged Plug Valve"))
                          ("Pressure Reducing Regulator"       . ("Pressure Reducing Regulator" "Flanged Pressure Reducing Regulator" "Pressure Reducing Regulator w External Tap"))
                          ("Solenoid Valves"       . ("Two-Way Solenoid Valve" "Three-Way Solenoid Valve" "Four-Way Solenoid Valve" "Three-Way Solenoid Valve w Manual Reset" "Flanged Three-Way Solenoid Valve" "Flanged Three-Way Solenoid

Valve w Manual Reset" "Flanged Two-Way Solenoid Valve"))
                          ("Three Way Valves"       . ("Three Way Valve" "Flanged Three Way Valve" "Three Way Control Valve - HO" "Piston Operated Three Way Valve" "Pilot Valve w Manual Reset" "Flanged Pilot Valve w Manual Reset"

"Flanged Three Way Control Valve - HO" "Flanged Piston Operated Three-Way Valve"))
  ("Misc Valves"       . ("Rotary Valve" "Diaphragm Valve" ))))
 
       ("Instruments"      . (("Local Panel"       . ("Local Panel Mounted Programmable Logic Control" "Local Panel Mounted Instrument" "Local Panel mounted Computer Function" "Local Mounted Programmable Logic Control" "Local Mounted

Instrument" "Local Mounted Computer Function" "Behind Local Panel Instrument"))
                          ("Control Panel"      . ("Control Panel Mounted Programmable Logic Control" "Control Panel Mounted Instrument" "Control Panel Mounted Computer Function" "Behind Control Panel Mounted Programmable Logic Control"

"Behind Control Panel Instrument"))
                          ("Shared Display"  . ("Shared Display with Instrument Bubble"))))

       ("Stamps"     . (("Issued For:"       . ("Flgd Angle Valve" "Flgd Four-Way Valve" "Flgd Three-Way Ball Valve" "Flgd Three-Way Valve"))
                          ("Note:"  . ("Flgd Backpressure Regulator" "Flgd Pressure Reducing Regulator" "Flgd Backpressure Regulator w External Tap" "Flgd Pressure Reducing Regulator w External Tap"))
                          ("Other"  . ("Fldg Ball Type Control Valve" "Flgd Two Way Motor Operated Ball Vlv" "Flgd Piston Op Ball Valve"))
                          ))
      )
  )
« Last Edit: October 01, 2013, 01:42:03 PM by Bhull1985 »

Bhull1985

  • Guest
Re: Routine not working, please help.
« Reply #13 on: October 01, 2013, 01:41:46 PM »
Would I need to wrap the slide variable setq in a conditional statement asking what "model" is?
Something like
(cond
(= model "Angle Valve")(setq lst "Angle Valve Vis1" "Angle Valve Vis2" "Angle Valve Vis3")
(= model "Backpressure Regulators")(setq lst "Backpressure Regulator Vis1" "Backpress Vis2....etc?

I will try it !

Bhull1985

  • Guest
Re: Routine not working, please help.
« Reply #14 on: October 01, 2013, 02:48:56 PM »
I feel like I am getting close
But I am getting a fixnump error
and am being pulled off onto some client work
Code: [Select]
(defun c:test ( / *error* MakeList key lst dc Make Models Model Year flag path file)
(vl-load-com)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ERROR HANDLER;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  (defun *error* ( msg ) ;;
    (and dc (unload_dialog dc)) ;;
    (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") ;;
        (princ (strcat "\n** Error: " msg " **"))) ;;
    (princ) ;;
  ) ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;PATH VARIABLE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq path "Y:\\bhull\\_Lispl3ox\\_Untestecl\\") ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;BEGINNING OF LIST lst;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  (cond
( (= model "Angle Valves")
(setq lst (list nil "Angle Valve" "Angle Control Valve" "Flanged Angle Valve" "Flanged Angle Control Valve")         
File$ (nth 1 lst)
File$ (nth 2 lst)
File$ (nth 3 lst)
File$ (nth 4 lst)
);setq
);cond
( (= model "Backpressure Regulators")
(setq lst (list nil "Backpressure Regulator" "Flanged Backpressure Regulator" "Backpressure Regulator w External Tap")
File$ (nth 1 lst)
File$ (nth 2 lst)
File$ (nth 3 lst)
);setq
);cond

( (= model "Ball Valves")
(setq lst (list nil "Two-Way Motor Operated Ball Valve" "Double Acting Piston Valve - Air Operated" "Piston Operated Ball Valve" "Flanged Motor Operated Ball Valve" "Flanged Piston Operated Ball Valve" "Flanged Ball Type Control

Valve" "Flanged Double Acting Piston Valve - Air Operated" "Flanged Ball Valve" "Flanged Ball Valve w Bleed Valve" "Flanged Three-Way Ball Valve")
File$ (nth 1 lst)
File$ (nth 2 lst)
File$ (nth 3 lst)
File$ (nth 4 lst)
File$ (nth 5 lst)
File$ (nth 6 lst)
File$ (nth 7 lst)
          File$ (nth 8 lst)
          File$ (nth 9 lst)
          File$ (nth 10 lst)
);setq
);cond
( (= model "Bleed Valves")
(setq lst (list nil "Ball Valve w Bleed Valve" "Gate Valve w Bleed Valve" "Flanged Ball Valve w Bleed Valve" "Flanged Gate Valve w Bleed Valve" "Flanged Gate Valve w Bleed Valve and Piston Actuator" "Gate Valve w Bleed Valve and

Piston Actuator")
File$ (nth 1 lst)
File$ (nth 2 lst)
File$ (nth 3 lst)
File$ (nth 4 lst)
File$ (nth 5 lst)
File$ (nth 6 lst)
);setq
);cond
( (= model "Butterfly On-Off Valve")
(setq lst (list nil "Butterfly On-Off Valve" "Flanged Butterfly On-Off Valve" "Butterfly Valve" "Flanged Butterfly Valve" "Butterfly Control Valve - HO" "Flanged Butterfly Control Valve - HO" "Butterfly Control Valve" "Flanged

Butterfly Control Valve")
File$ (nth 1 lst)
File$ (nth 2 lst)
File$ (nth 3 lst)
File$ (nth 4 lst)
File$ (nth 5 lst)
File$ (nth 6 lst)
File$ (nth 7 lst)
          File$ (nth 8 lst)
);setq
);cond
( (= model "Check Valves")
(setq lst (list nil "Check Valve" "Flanged Check Valve")
File$ (nth 1 lst)
File$ (nth 2 lst)
);setq
);cond
( (= model "Dia and Hand Act Control Valves")
(setq lst (list nil "Control Valve w Hand Actuator" "Flanged Control Valve w Hand Actuator" "Diaphragm Actuated Control Valve" "Flanged Diaphragm Actuated Control Valve")
File$ (nth 1 lst)
File$ (nth 2 lst)
File$ (nth 3 lst)
File$ (nth 4 lst)
);setq
);cond
( (= model "Four Way Valves")
(setq lst (list nil "Four Way Valve" "Flanged Four Way Valve")
File$ (nth 1 lst)
File$ (nth 2 lst)
);setq
);cond
( (= model "Gate Valves")
(setq lst (list nil "Gate Valve" "Flanged Gate Valve" "Right Flanged Gate Valve" "Left Flanged Gate Valve" "Piston Operated Gate Valve" "Flanged Piston Operated Gate Valve")
        File$ (nth 1 lst)
        File$ (nth 2 lst)
        File$ (nth 3 lst)
        File$ (nth 4 lst)
        File$ (nth 5 lst)
        File$ (nth 6 lst)
   );setq
);cond
);cond


  (setq Data

     '(

       ("Valves"      . (("Angle Valves"     . ("Angle Valve" "Angle Control Valve" "Flanged Angle Valve" "Flanged Angle Control Valve"))
                          ("Backpressure Regulators"     . ("Backpressure Regulator" "Flanged Backpressure Regulator" "Backpressure Regulator w External Tap"))
                          ("Ball Valves"     . ("Two-Way Motor Operated Ball Valve" "Double Acting Piston Valve - Air Operated" "Piston Operated Ball Valve" "Flanged Motor Operated Ball Valve" "Flanged Piston Operated Ball Valve"

"Flanged Ball Type Control Valve" "Flanged Double Acting Piston Valve - Air Operated" "Flanged Ball Valve" "Flanged Ball Valve w Bleed Valve" "Flanged Three-Way Ball Valve"))
                          ("Bleed Valves"     . ("Ball Valve w Bleed Valve" "Gate Valve w Bleed Valve" "Flanged Ball Valve w Bleed Valve" "Flanged Gate Valve w Bleed Valve" "Flanged Gate Valve w Bleed Valve and Piston Actuator" "Gate

Valve w Bleed Valve and Piston Actuator"))
                          ("Butterfly On-Off Valve"     . ("Butterfly On-Off Valve" "Flanged Butterfly On-Off Valve" "Butterfly Valve" "Flanged Butterfly Valve" "Butterfly Control Valve - HO" "Flanged Butterfly Control Valve - HO"

"Butterfly Control Valve" "Flanged Butterfly Control Valve"))
                          ("Check Valves"       . ("Check Valve" "Flanged Check Valve"))
                          ("Dia and Hand Act Control Valves"       . ("Control Valve w Hand Actuator" "Flanged Control Valve w Hand Actuator" "Diaphragm Actuated Control Valve" "Flanged Diaphragm Actuated Control Valve"))
                          ("Four Way Valves"       . ("Four Way Valve" "Flanged Four Way Valve"))
                          ("Gate Valves"       . ("Gate Valve" "Flanged Gate Valve" "Right Flanged Gate Valve" "Left Flanged Gate Valve" "Piston Operated Gate Valve" "Flanged Piston Operated Gate Valve"))
                          ("Globe Valves"       . ("Globe Valve" "Flanged Globe Valve" "Globe Control Valve" "Flanged Globe Control Valve"))
                          ("Motor Operated Valves"       . ("Motor Operated Valve" "Flanged Motor Operated Valve" "Two-Way Motor Operated Ball Valve" "Flanged Motor Operated Ball Valve" "Right Flanged Motor Operated Valve" "Left Flanged

Motor Operated Valve"))
                          ("Needle Valves"       . ("Needle Valve" "Small Needle Valve" "Flanged Needle Valve"))
                          ("Plug Valves"       . ("Plug Valve" "Flanged Plug Valve"))
                          ("Pressure Reducing Regulator"       . ("Pressure Reducing Regulator" "Flanged Pressure Reducing Regulator" "Pressure Reducing Regulator w External Tap"))
                          ("Solenoid Valves"       . ("Two-Way Solenoid Valve" "Three-Way Solenoid Valve" "Four-Way Solenoid Valve" "Three-Way Solenoid Valve w Manual Reset" "Flanged Three-Way Solenoid Valve" "Flanged Three-Way Solenoid

Valve w Manual Reset" "Flanged Two-Way Solenoid Valve"))
                          ("Three Way Valves"       . ("Three Way Valve" "Flanged Three Way Valve" "Three Way Control Valve - HO" "Piston Operated Three Way Valve" "Pilot Valve w Manual Reset" "Flanged Pilot Valve w Manual Reset"

"Flanged Three Way Control Valve - HO" "Flanged Piston Operated Three-Way Valve"))
  ("Misc Valves"       . ("Rotary Valve" "Diaphragm Valve" ))))
 
       ("Instruments"      . (("Local Panel"       . ("Local Panel Mounted Programmable Logic Control" "Local Panel Mounted Instrument" "Local Panel mounted Computer Function" "Local Mounted Programmable Logic Control" "Local Mounted

Instrument" "Local Mounted Computer Function" "Behind Local Panel Instrument"))
                          ("Control Panel"      . ("Control Panel Mounted Programmable Logic Control" "Control Panel Mounted Instrument" "Control Panel Mounted Computer Function" "Behind Control Panel Mounted Programmable Logic Control"

"Behind Control Panel Instrument"))
                          ("Shared Display"  . ("Shared Display with Instrument Bubble"))))

       ("Stamps"     . (("Issued For:"       . ("Flgd Angle Valve" "Flgd Four-Way Valve" "Flgd Three-Way Ball Valve" "Flgd Three-Way Valve"))
                          ("Note:"  . ("Flgd Backpressure Regulator" "Flgd Pressure Reducing Regulator" "Flgd Backpressure Regulator w External Tap" "Flgd Pressure Reducing Regulator w External Tap"))
                          ("Other"  . ("Fldg Ball Type Control Valve" "Flgd Two Way Motor Operated Ball Vlv" "Flgd Piston Op Ball Valve"))
                          ))
      )
  )


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;END OF LIST lst;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;BEGIN SUBFUNCTIONS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun MakeList ( key l /)
    (start_list key)
    (mapcar (function add_list) l)
    (end_list)
  )



(defun slide ( key file )
    (if (setq file (findfile file))
      (progn
        (start_image key)
        (fill_image 0 0 (dimx_tile key) (dimy_tile key) 0)
        (slide_image 1 1 (- (dimx_tile key) 2) (- (dimy_tile key) 2) file)
        (end_image)
      )
    )
  ) 



(defun my-block-files (path /)
(setq lst
(vl-directory-files path  "*.dwg" 1))
  )



(defun updateimage (file key)
(setq width (dimx_tile key))
(setq height (dimy_tile key))
(start_image key)
  (fill_image 0 0 (dimx_tile key) (dimy_tile key) -15); and change to your image name
(slide_image 1 1 width height file)
(end_image)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;END OF FUNCTIONS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;BEGIN MAIN LOOP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  (cond (  (<= (setq dc (load_dialog "Example.dcl")) 0)

           (princ "\n** DCL File not Found **"))

        (  (not (new_dialog "test" dc))

           (princ "\n** Dialog could not be loaded **"))

        (t

           (MakeList "make"  (mapcar (function car) Data))
           (setq Make  (atoi (set_tile "make" "0")))
             
           (MakeList "model" (mapcar (function car) (cdar Data)))
           (setq Model (atoi (set_tile "model" "0")))

           (MakeList "year"  (cdadar Data))
           (setq Year  (atoi (set_tile "year" "0")))

;    (MakeList "blox" (my-block-files path))
           (setq blox (my-block-files path))

;(set_tile "sld" (nth Year lst))

(setq key "sld")
(slide "sld" (vl-filename-base (strcat path (nth (itoa $value) lst) ".sld")))



           (action_tile "make"  "(MakeList \"model\"
                                   (mapcar (function car)
                                     (setq Models (cdr (nth (setq Make (atoi $value)) Data)))))
                                 (set_tile \"model\" \"0\")
                                 (MakeList \"year\" (cdar Models))
                                 (setq Year (atoi (set_tile \"year\" \"0\")))")

           (action_tile "model" "(MakeList \"year\" (cdr (nth (setq Model (atoi $value)) Models)))
                                 (setq Year (atoi (set_tile \"year\" \"0\")))")

           (action_tile "year" "(setq file (atoi $value))(updateimage year file)")





           (setq flag (start_dialog) dc (unload_dialog dc))

           (if (= 1 flag)
             (progn
(updateimage (nth year blox) sld)
               (setq Selection (nth Make Data)
                     Make      (car Selection)
                     Models    (nth Model (cdr Selection))
                     Model     (car Models)
                     Year      (nth Year  (cdr Models)))

              (command "_insert" year pause "" "" pause))

             (princ "\n*Cancel*")
     )))
  (princ))




Bhull1985

  • Guest
Re: Routine not working, please help.
« Reply #15 on: October 01, 2013, 04:56:51 PM »
I am unsuccessful in having (itoa $value) be passed back to the (slide) function.
It keeps giving me a fixnump or stringp error depending on what I try
Can someone please tell me how to have the value of "year" be passed back to the slide function correctly?
Thank you.
Something to do with CABs reply, but I cannot get the VLIDE to display the watches correctly, it just freezes up my autocad and requires task manager else I would try to watch and determine which var to manipulate and how but I can't even tell.
Someone...anyone....*says a quick prayer that this thread will receive a response*

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Routine not working, please help.
« Reply #16 on: October 02, 2013, 09:41:05 AM »
See if this gets you any closer.

I've reached the age where the happy hour is a nap. ()
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Routine not working, please help.
« Reply #17 on: October 02, 2013, 10:39:42 AM »
OK I like this version better.

I've reached the age where the happy hour is a nap. ()
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Bhull1985

  • Guest
Re: Routine not working, please help.
« Reply #18 on: October 02, 2013, 10:42:23 AM »
Oh my goodness
You are absolutely the best!!!

This is incredible, instead of dealing with stringp/fixnump/consp errors I can now dissect what you've shown me to gain understanding.

Seriously, thank you very much CAB. If there's anything I can ever do for you just please let me know, you have no idea how much this means to me.
I was thinking that this routine would be the first failure but thanks to you- it's not.
Now time to stop being utterly giddy, and look at how you've made this work.
Oh I see that there's an update, and I'm dying to know if I was correct in applying the (cond) with the (and) statements as shown in this (likely incorrect) example.
It'll likely be time for me to clear all the junk I've got flying around in my head to take a fresh look at what you've done.

Bhull1985

  • Guest
Re: Routine not working, please help.
« Reply #19 on: October 02, 2013, 10:45:11 AM »
Does the 2nd version have the lists empty in your run?

The first one you posted was displaying the previews correctly (you're amazing- have I mentioned that?)

Then when I checked to see the 2nd version it's showing the slide in the preview window but all of the list_boxes are empty.
Probably something small, but i'm curious as to if the 2nd version has the lists populated on your machine when you run it.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Routine not working, please help.
« Reply #20 on: October 02, 2013, 11:42:25 AM »
OOps I'll update

I've reached the age where the happy hour is a nap. ()
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Bhull1985

  • Guest
Re: Routine not working, please help.
« Reply #21 on: October 02, 2013, 11:51:30 AM »
Np CAB,
I'm still stunned that you were able to make that mess into something working.
And still very appreciative.
I'm finishing up the last slides now and will be sure to post in this thread with a (closer-to) complete routine, thanks so much for showing me that this was possible and how to do it properly.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Routine not working, please help.
« Reply #22 on: October 02, 2013, 12:14:27 PM »
See attached, revised.
Also changed the names in the DCL.

I've reached the age where the happy hour is a nap. ()
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Bhull1985

  • Guest
Re: Routine not working, please help.
« Reply #23 on: October 02, 2013, 03:59:45 PM »
Great CAB, this works very well.
I have just finished making the rest of the slides so that it previews correctly. There's just over 100 of them so I won't be attaching them here... :P
I notice the changes to the action tile and will look into the vl-prin1-to-string function surely, seems to have made the difference there...
Another bit that I'll look up on is the
Code: [Select]
(mapcar (function car) arguments) because it's used extensively throughout the routine.
Breaking it down some each of those pieces of code are nested within the following statements, firstly:
Code: [Select]
(defun makelist (k l /)
(start_list k)
(mapcar (function add_list) l)
(end_list)
)
and then within the calls to that function
Code: [Select]
(makelist "part_catagory" (setq CaragoriesLst (mapcar (function car) data)))
(makelist "part_name" (setq NamesLst (mapcar (function car)(cadr (car Data)))))
(makelist "part_item" (setq ItemsLst (cadr (caadar data))))

All seem like pretty decipherable I'll just have to take them from the most nested statement outwards. Going to be a challenge to take it all apart, onto the console to see how it's all working but I look forward to the challenge.
Also the Visual Lisp Format Options at the bottom, that's something that I had never seen until yesterday actually, and haven't quite located what requires it but will continue to spend a lot of time with this baby, I really appreciate it and admire your skills at making it work. I don't think many people can do this sort of code, and I'm honored that you've given me the chance to learn.
I still have some ways to go....but this will occupy me for a great while.
Thanks indeed, and just give a pm if youd want view it with the slides.
Oh one more thing - there's this consp error that occurs if an item in the part_name is the first user selection after dcl opens.
I look forward to Vlide'ing that as well :)
« Last Edit: October 02, 2013, 04:32:00 PM by Bhull1985 »

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Routine not working, please help.
« Reply #24 on: October 02, 2013, 04:33:22 PM »
On my way out but will reply tonight.

I've reached the age where the happy hour is a nap. ()
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Bhull1985

  • Guest
Re: Routine not working, please help.
« Reply #25 on: October 02, 2013, 05:04:06 PM »
Have a good'n.
Okay, "function" is declaring the following to be a function, so what's actually happening is the (car) of data=caragoriesLst
Then namesLst is the (car) of (cadr (car data)), and so on and so forth for each iteration.
Sweet stuff, and now I'll really gain some understanding of how lists work in lisp once I setq data in the console and start (car) and nesting them as well.
Whoo, I feel like I've just been handed the rosetta stone. The actual one, not the software....onwards!

Eureka!
Code: [Select]
Command: (car data)
("Valves" (("Angle Valves" ("Angle Valve" "Angle Control Valve" "Flanged Angle
Valve" "Flanged Angle Control Valve")) ("Backpressure Regulators"
("Backpressure Regulator" "Flanged Backpressure Regulator" "Backpressure
Regulator w External Tap")) ("Ball Valves" ("Two-Way Motor Operated Ball Valve"
"Double Acting Piston Valve - Air Operated" "Piston Operated Ball Valve"
"Flanged Motor Operated Ball Valve" "Flanged Piston Operated Ball Valve"
"Flanged Ball Type Control Valve" "Flanged Double Acting Piston Valve - Air
Operated" "Flanged Ball Valve" "Flanged Ball Valve w Bleed Valve" "Flanged
Three-Way Ball Valve")) ("Bleed Valves" ("Ball Valve w Bleed Valve" "Gate Valve
w Bleed Valve" "Flanged Ball Valve w Bleed Valve" "Flanged Gate Valve w Bleed
Valve" "Flanged Gate Valve w Bleed Valve and Piston Actuator" "Gate Valve w
Bleed Valve and Piston Actuator")) ("Butterfly On-Off Valve" ("Butterfly On-Off
Valve" "Flanged Butterfly On-Off Valve" "Butterfly Valve" "Flanged Butterfly
Valve" "Butterfly Control Valve - HO" "Flanged Butterfly Control Valve - HO"
"Butterfly Control Valve" "Flanged Butterfly Control Valve")) ("Check Valves"
("Check Valve" "Flanged Check Valve")) ("Dia and Hand Act Control Valves"
("Control Valve w Hand Actuator" "Flanged Control Valve w Hand Actuator"
"Diaphragm Actuated Control Valve" "Flanged Diaphragm Actuated Control Valve"))
("Four Way Valves" ("Four Way Valve" "Flanged Four Way Valve")) ("Gate Valves"
("Gate Valve" "Flanged Gate Valve" "Right Flanged Gate Valve" "Left Flanged
Gate Valve" "Piston Operated Gate Valve" "Flanged Piston Operated Gate Valve"))
("Globe Valves" ("Globe Valve" "Flanged Globe Valve" "Globe Control Valve"
"Flanged Globe Control Valve")) ("Motor Operated Valves" ("Motor Operated
Valve" "Flanged Motor Operated Valve" "Two-Way Motor Operated Ball Valve"
"Flanged Motor Operated Ball Valve" "Right Flanged Motor Operated Valve" "Left
Flanged Motor Operated Valve")) ("Needle Valves" ("Needle Valve" "Small Needle
Valve" "Flanged Needle Valve")) ("Plug Valves" ("Plug Valve" "Flanged Plug
Valve")) ("Pressure Reducing Regulator" ("Pressure Reducing Regulator" "Flanged
Pressure Reducing Regulator" "Pressure Reducing Regulator w External Tap"))
("Solenoid Valves" ("Two-Way Solenoid Valve" "Three-Way Solenoid Valve"
"Four-Way Solenoid Valve" "Three-Way Solenoid Valve w Manual Reset" "Flanged
Three-Way Solenoid Valve" "Flanged Three-Way Solenoid Valve w Manual Reset"
"Flanged Two-Way Solenoid Valve")) ("Three Way Valves" ("Three Way Valve"
"Flanged Three Way Valve" "Three Way Control Valve - HO" "Piston Operated Three
Way Valve" "Pilot Valve w Manual Reset" "Flanged Pilot Valve w Manual Reset"
"Flanged Three Way Control Valve - HO" "Flanged Piston Operated Three-Way
Valve")) ("Misc Valves" ("Rotary Valve" "Diaphragm Valve"))))
and vastly different
Code: [Select]
Command: (mapcar (function car) data)
("Valves" "Instruments" "Stamps")
« Last Edit: October 02, 2013, 05:08:07 PM by Bhull1985 »

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Routine not working, please help.
« Reply #26 on: October 03, 2013, 10:20:30 AM »
Yes you're getting it.  8)

The vl-prin1-to-string is just a method that allows you to view the code clearly in VLIDE & doesn't require you to quote the code.

Code: [Select]
(mapcar (function car) arguments)Just a way to preform the function CAR on every item in the list ARGUMENTS.
And it returns the results in a list.
Code: [Select]
(mapcar (function car) '((1 1 1)(2 2 2)(3 3 3)))  
returns  (1 2 3)

Visual Lisp Format Options at the bottom:
That is a setting in VLIDE to put the format code in the lisp so any future user in VLIDE will automatically use the formatting for that lisp.

You're welcome for the help. My time is limited due to current work load so there may be times I neglect you. :)

Attached is a fix for the error you were getting.
« Last Edit: October 03, 2013, 10:23:32 AM by CAB »
I've reached the age where the happy hour is a nap. ()
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Bhull1985

  • Guest
Re: Routine not working, please help.
« Reply #27 on: October 03, 2013, 02:25:59 PM »
Just got back to the office from a 4 hour class to get a certification.
Well that's done and I'll get a few hours with this and a few other tools that I've been thinking of!
We've got several programs that we run along with autocad and I am starting to think about what autolisp may be able to do in so far as opening these programs...just little shortcuts, I'm thinking, but it sounds fun to do next week or whatnot....
Because we know what i'll be doing for the next good while , still!
Anyhow thanks CAB, don't worry about 'neglect' because what you've shown me is so far from neglect I could kiss you.
Aha...    :-P

also that's interesting it looks as if you turned the data that makelist "part_name" uses into a variable containing a list, to fix the consp error. Makes sense if that's correct- also the differing syntax at the very bottom i'll need to look closer at. Thankyou!!
« Last Edit: October 03, 2013, 02:31:19 PM by Bhull1985 »

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Routine not working, please help.
« Reply #28 on: October 03, 2013, 03:45:00 PM »
The variable Names needed to be initialized during the start up of the DCl.
Before I had it as one of the Actions to refresh it's data and still is.
What happened was when you clicked on tile  "part_name" it needed the Names list to be valid.
Before it was nil at start up.

Glad you can make use of the routine now.

 
Quote
I am starting to think about what autolisp may be able to do in so far as opening these programs...just little shortcuts
That's how to learn, start with little helper routines and expand as you knowledge grows.

Enjoy.


I've reached the age where the happy hour is a nap. ()
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.