Author Topic: SSX in dialog form  (Read 4466 times)

0 Members and 1 Guest are viewing this topic.

TJAM51

  • Guest
SSX in dialog form
« on: September 15, 2004, 11:42:37 AM »
Anyone come across a dialog form of SSX?

V-Man

  • Bull Frog
  • Posts: 343
  • I exist therefore I am! Finally Retired!
SSX in dialog form
« Reply #1 on: September 15, 2004, 12:04:53 PM »
Yes, here you go

Code: [Select]

(defun c:get (/ blkname dcl_id etype theList layNmList elyr
                eltype eLTypeList blkName Blks tstyle styles
                thkns ecolor txtht txtval ss)
  (setq thelist nil)

  ;; load the dialog box
;;  (setq dcl_id (load_dialog (strcat lispdir "get.dcl")))
  (setq dcl_id (load_dialog "get.dcl")) ;;for NBBB

  (if (not (new_dialog "ddget" dcl_id))
    (progn
      (alert "couldn't load dialog")
      (exit)
    );progn
  );if
;;added
; (IF (= nil id:lispold)
;     (setq id:lispold "x")
;     (setq id:lispold id:lisp))
; (setq id:lisp "GET.lsp")
;(c:LispCounter)
;;added
  (action_tile "accept"
      (strcat
        "(getres)"
        "(done_dialog 0)"
      );strcat
  ) ;;action_tile

  (action_tile "cancel"
    "(done_dialog 0)"
  );action_tile


  ;;set values in list boxes
  (setLists)

  ;;Now, run the dialog
  (start_dialog)
  (unload_dialog dcl_id)


  ;;Now collect the answers into a list to pass to ssget.
  (if etype
  (if (/="0" etype)
    (progn
      (setq etype (cons 0 (nth (atoi etype) etypelist)))
      (if (/= "" (cdr etype))
        (setq thelist (cons etype thelist))
      );if
    );progn
  );if
  );if

  (if elyr
  (if (/="0" elyr)
    (progn
      (setq elyr (cons 8 (nth (-(atoi elyr)1) laynmlst)))
      (if (/= "" (cdr elyr))
        (setq thelist (cons elyr thelist))
      );if
    );progn
  );if
  );if

  (if eltype
  (if (/="0" eltype)
    (progn
      (setq eltype (cons 6 (nth (atoi eltype) eltypelist)))
      (if (/= "" (cdr eltype))
        (setq thelist (cons eltype thelist))
      );if
    );progn
  );if
  );if

  (if (/= "0" blkname)
  (if (/="" blkname)
    (progn
      (setq blkname (cons 2 (nth (-(atoi blkname)1) Blks)))
      (if (/= "" (cdr blkname))
        (setq thelist (cons blkname thelist))
      );if
    );progn
  );if
  );if

  (if tstyle
  (if (/="0" tstyle)
    (progn
      (setq tstyle (cons 7 (nth (-(atoi tstyle)1) styls)))
      (if (/= "" (cdr tstyle))
        (setq thelist (cons tstyle thelist))
      );if
    );progn
  );if
  );if

  (if (/= "" thkns)
    (progn
      (setq thkns (cons 39 (atof thkns)))
      (setq thelist (cons thkns thelist))
    );progn
  );if

  (if (/= "" ecolor)
    (progn
      (setq ecolor (cons 62 (atoi ecolor)))
      (setq thelist (cons ecolor thelist))
    );progn
  );if


  (if (/= "" txtht)
    (progn
      (setq txtht (cons 40 (atof txtht)))
      (setq thelist (cons txtht thelist))
    );progn
  );if


  (if (/= "" txtval)
    (progn
      (setq txtval (cons 1 txtval))
      (setq thelist (cons txtval thelist))
    );progn
  );if


  ;;Finally, collect the selection set.
  (if thelist
    (progn
      (if (setq ss (ssget "x" thelist))
        (progn
          (setq l (itoa (sslength ss)))
          (princ (strcat "\n" l " entities selected."))
        );progn
        (progn
          (Alert "No entities selected")
        );progn
      );if(setq ss (ssget "x" thelist))
      (princ)
    );progn
    (Alert "No entities selected")
  );if
  SS
);c:get



(defun getres ()
  ;;get values of controls & close the dialog
  (setq etype (get_tile "ddenttype"))
  (setq elyr (get_tile "ddentlyr"))
  (setq eltype (get_tile "ddentltype"))
  (setq blkname (get_tile "ddblkname"))
  (setq tstyle (get_tile "ddstyle"))
  (setq ecolor (get_tile "ddentcolor"))
  (setq thkns (get_tile "ddentthkns"))
  (setq txtval (get_tile "ddtxtval"))
  (setq txtht (get_tile "ddtxtht"))
  (done_dialog 0)
);getres


(defun setLists ()
   ;;setup list for entity type listbox
   (setq etypelist '("" "ARC" "CIRCLE" "DIMENSION" "INSERT" "LINE" "POINT" "SPLINE" "LWPOLYLINE" "TEXT"))
   (start_list "ddenttype" )
   (mapcar 'add_list etypelist)
   (end_list)


   ;;setup list for layer listbox
   (if (not BOGUSlay-idx) ;DUMMY TEST - USED TO PRECLUDE SEARCHING LAYER TBL EACH TIME.
       (makelaylists)                     ; layer list - laynmlst
   )
   (start_list "ddentlyr")
   (add_list "" )
   (mapcar 'add_list laynmlst)
   (end_list)

   ;;setup list for linetype listbox
   ;;do similar code to layer listbox to find layers in dwg.
   (setq eltypelist '("" "CONTINUOUS" "CENTER" "CENTER2" "DASHED" "DASHED2" "HIDDEN" "HIDDEN2" "PHANTOM" "PHANTOM2"))
   (start_list "ddentltype" )
   (mapcar 'add_list eltypelist)
   (end_list)

   ;;setup list for style listbox
   (setq styls nil)
   (setq styls (cons (cdr (assoc 2 (tblnext "style" t))) styls)) ;;rewind table on first call
   (if styls
     (progn
       (while
         (/= nil (setq styl(tblnext "style"))
           (if (/= nil styl)(setq styls (cons (cdr (assoc 2 styl)) styls)))
         );/=
       );while
     );progn
   );if styls

   (start_list "ddstyle")
   (add_list "")
   (mapcar 'add_list styls)
   (end_list)


   ;;setup list for blockname listbox
   (setq blks nil)
   (setq blks (cons (cdr (assoc 2 (tblnext "BLOCK" t))) blks)) ;;rewind table on first call
   (if (/= (nth 0 blks) nil)
     (progn
       (while
         (/= nil (setq blk(tblnext "BLOCK"))
           (if (/= nil blk)(setq blks (cons (cdr (assoc 2 blk)) blks)))
         );/=
       );while
     );progn
     (setq blks nil)
   );if blks

   (if blks
     (progn
       (start_list "ddblkname")
       (add_list "")
       (mapcar 'add_list blks)
       (end_list)
     );progn
   );if blks

); setlists





  ;; This function makes a list called laynmlst which consists of all the layer
  ;; names in the drawing.  It also creates a list called longlist which
  ;; consists of strings which contain the layer name, color, linetype, etc.
  ;; Longlist is later mapped into the layer listbox.  Both are ordered the
  ;; same.
  ;;
  (defun makelaylists (/ layname onoff frozth color linetype vpf vpn ss cvpname
                         xdlist vpldata sortlist name templist bit-70
                         layer_number
                      )
    (if (= (setq tilemode (getvar "tilemode")) 0)
      (progn
        (setq ss (ssget "_x" (list (cons 0 "VIEWPORT")
                                  (cons 69 (getvar "CVPORT"))
                            )
                 )
        )
        (setq cvpname (ssname ss 0))
        (setq xdlist (assoc -3 (entget cvpname '("acad"))))
        (setq vpldata (cdadr xdlist))
      )
    )
    (setq sortlist nil)
    (setq templist (tblnext "LAYER" T))
    (setq layer_number 1)
    (while templist
      (setq name (cdr (assoc 2 templist)))
      (setq sortlist (cons name sortlist))
      (setq templist (tblnext "LAYER"))
      ;; Not dead message...
      (if (= (/ layer_number 50.0) (fix (/ layer_number 50.0)))
        (set_tile "error" (strcat "Collecting..." (itoa layer_number)))
      )
      (setq layer_number (1+ layer_number))
    )
    (set_tile "error" "")
    (if (>= (getvar "maxsort") (length sortlist))
      (progn
        (if (> layer_number 50)
          (set_tile "error" "Sorting...")
        )
        (setq sortlist (acad_strlsort sortlist))
      )
      (setq sortlist (reverse sortlist))
    )
    (set_tile "error" "")
    (setq laynmlst sortlist)
    (setq longlist nil)
    (setq layname (car sortlist))
    (setq layer_number 1)
    (while layname
      (if (= (/ layer_number 50.0) (fix (/ layer_number 50.0)))
        (set_tile "error" (strcat "Analyzing..." (itoa layer_number)))
      )
      (setq layer_number (1+ layer_number))
      (setq laylist (tblsearch "LAYER" layname))
      (setq color (cdr (assoc 62 laylist)))
      (if (minusp color)
        (setq onoff ".")
        (setq onoff "On")
      )
;      (setq color (abs color))
      (setq colname (getvar "cecolor"))
      (setq bit-70 (cdr (assoc 70 laylist)))
      (if (= (logand bit-70 1) 1)
        (setq frozth "F" fchk laylist)
        (setq frozth ".")
      )
      (if (= (logand bit-70 2) 2)
        (setq vpn "N")
        (setq vpn ".")
      )
      (if (= (logand bit-70 4) 4)
        (setq lock "L")
        (setq lock ".")
      )
      (setq linetype (cdr (assoc 6 laylist)))
      (setq layname (substr layname 1 31))
      (if (= tilemode 0)
        (progn
          (if (member (cons 1003 layname) vpldata)
            (setq vpf "C")
            (setq vpf ".")
          )
        )
        (setq vpf ".")
      )
      (setq ltabstr (strcat layname "\t"
                              onoff "\t"
                             frozth "\t"
                               lock "\t"
                                vpf "\t"
                                vpn "\t"
                            colname "\t"
                           linetype
                    )
      )
      (setq longlist (append longlist (list ltabstr)))
      (setq sortlist (cdr sortlist))
      (setq layname (car sortlist))
    )
    (set_tile "error" "")
  )




(princ)



Code: [Select]

ddget : dialog {
  label = "SELECT PROPERTIES TO FILTER ON";
  : popup_list {
      key = "ddenttype";
      label = "Entity type: ";
      height=1;
    }//popup_list box
  : popup_list {
      key = "ddentlyr";
      label = "Entity Layer: ";
      height=1;
      width=15;
    }//popup_list box
  : popup_list {
      key = "ddentltype";
      label = "Entity Linetype: ";
      height=1;
    }//popup_list box

  : popup_list {
      key = "ddblkname";
      label = "Block Name: ";
      height=1;
    }//popup_list box

  : popup_list {
      key = "ddstyle";
      label = "Text Style: ";
      height=1;
    }//popup_list box

  : edit_box {
      key = "ddentcolor";
      label = "Entity Color: ";
      height=1;
    }//edit_box

  : edit_box {
      key = "ddentthkns";
      label = "Entity Thickness: ";
      height=1;
    }//edit_box

  : edit_box {
      key = "ddtxtval";
      label = "Text value: ";
      height=1;
    }//edit_box

  : edit_box {
      key = "ddtxtht";
      label = "Text height: ";
      height=1;
    }//edit_box

   ok_cancel;

} //ddget : dialog
AutoCAD 9 - 2023, AutoCADMap 2008 - 2010, Revit 2012 - 2022, Autocad Civil 3D 2023

TJAM51

  • Guest
SSX in dialog form
« Reply #2 on: September 15, 2004, 12:10:47 PM »
Wow....IT IS A THING OF BEAUTY :D

SPDCad

  • Bull Frog
  • Posts: 453
SSX in dialog form
« Reply #3 on: September 15, 2004, 12:22:19 PM »
Thank you, appreciate this!  :)
AutoCAD 2010, w/ OpenDCL

visit: http://reachme.at/spd_designs

TJAM51

  • Guest
SSX in dialog form
« Reply #4 on: September 16, 2004, 08:35:59 AM »
Your routine is really nice and I was wondering if you ever decided to expand on it how about adding some buttons that would be edit or modify such as erase or move or change properties. There is small routine on Cadalog called Fprop which is a very fast and smaller change properties dialog.

Oak3s

  • Guest
SSX in dialog form
« Reply #5 on: October 13, 2004, 06:59:05 PM »
i dont have much experiance with programing. i use a lot of lisp aps at work but programing and making this work is a whole different thing for me. i wanted to check out that dialog and see how nice it looked. i hoping someone could tell me what i have to do to us this. any help would be appreciated. again, i dont know much about the programing but im trying to scarp my way around....a very slow process.
thanks again

CADaver

  • Guest
SSX in dialog form
« Reply #6 on: October 13, 2004, 07:05:35 PM »
ummm... FILTER?

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
SSX in dialog form
« Reply #7 on: October 13, 2004, 07:15:45 PM »
Quote from: CADaver
ummm... FILTER?

You nailed it RC.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Oak3s

  • Guest
SSX in dialog form
« Reply #8 on: October 13, 2004, 07:56:17 PM »
i just wanted to report that i figured it out. i didnt have it in my search path. i didnt want to look like someone who wasnt going to try to at least figure it out themselves.  i look forward to more learning though.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
SSX in dialog form
« Reply #9 on: October 13, 2004, 09:10:15 PM »
Quote from: Oak3s
i just wanted to report that i figured it out. i didnt have it in my search path. i didnt want to look like someone who wasnt going to try to at least figure it out themselves.  i look forward to more learning though.
Very good detective work. :)
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.

Anonymous

  • Guest
SSX in dialog form
« Reply #10 on: October 14, 2004, 08:12:21 AM »
try freeware of ssx2005 from kozmos vlae toolkit at http://www.ikozmos.com
the filtered values can be got by pick proto objects

SMadsen

  • Guest
SSX in dialog form
« Reply #11 on: October 14, 2004, 08:39:32 AM »
QSELECT ?