Author Topic: the Swamp Block Library Manager?  (Read 60994 times)

0 Members and 1 Guest are viewing this topic.

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: the Swamp Block Library Manager?
« Reply #30 on: February 10, 2010, 11:31:29 AM »
Thanks Lee, I'll have a look.

There are mistakes - I'm cleaning up now.  (and I apparently can't spell manager!)
James Buzbee
Windows 8

rhino

  • Guest
Re: the Swamp Block Library Manager?
« Reply #31 on: February 10, 2010, 11:41:44 AM »
some food for thought...

This is what we use in our Eng dept - does not need AutoCAD to be running.

I'll check if the previews are of the individual dwg or sld and have a word with the coder too :D


Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: the Swamp Block Library Manager?
« Reply #32 on: February 10, 2010, 12:04:02 PM »
Wow all this fancy dialog boxes put my pull-down with slides to shame. 
I will be the token lisp newbie that needs it tweaked to fit his uses.  :-)
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

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: the Swamp Block Library Manager?
« Reply #33 on: February 10, 2010, 01:15:05 PM »
Hey, Lee,

Ok, I've had a look and am very confused - can you give me a hand in revising this to only return directories - no files.

If you have time thanks, or just give me some simple instructions and I can take it from there!

Thanks!
James Buzbee
Windows 8

T.Willey

  • Needs a day job
  • Posts: 5251
Re: the Swamp Block Library Manager?
« Reply #34 on: February 10, 2010, 01:37:08 PM »
Not Lee, but here is one that will list all sub-directories.

Code: [Select]
(defun GetSubFolders ( path / GetSubs )
    
    (defun GetSubs ( path / tempList tempPath )
        
        (foreach i (vl-directory-files path "*" -1)
            (if
                (and
                    (not (= i "."))
                    (not (= i ".."))
                )
                (progn
                    (setq tempPath (strcat path i "\\") )
                    (setq tempList (cons tempPath tempList))
                    (setq tempList (append tempList (GetSubs tempPath)))
                )
            )
        )
        tempList
    )
    ;-------------------------------------------
    (vl-sort
        (cons path (GetSubs path))
        (function
            (lambda ( a b )
                (< (strcase a) (strcase b))
            )
        )
    )
)

Call like

Code: [Select]
(GetSubFolders "c:\\temp\\")

Edit:  Add what is returned.
Code: [Select]
Command: (getsubfolders "c:\\mycustom\\lisps\\")
("c:\\mycustom\\lisps\\" "c:\\mycustom\\lisps\\Ants\\"
"c:\\mycustom\\lisps\\Ants\\CADArmyAnts\\"
"c:\\mycustom\\lisps\\Ants\\CADArmyAnts\\Bin\\"
"c:\\mycustom\\lisps\\Ants\\CADArmyAnts\\Bin\\A2004\\"
"c:\\mycustom\\lisps\\Ants\\CADArmyAnts\\Bin\\A2007\\"
"c:\\mycustom\\lisps\\Downloaded\\" "c:\\mycustom\\lisps\\ForPosting\\")
« Last Edit: February 10, 2010, 01:43:25 PM by T.Willey »
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: the Swamp Block Library Manager?
« Reply #35 on: February 10, 2010, 01:44:46 PM »
Thanks Tim, I'll give it a try.
James Buzbee
Windows 8

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: the Swamp Block Library Manager?
« Reply #36 on: February 10, 2010, 05:03:23 PM »
Hey James,

I wasn't sure whether you wanted all files or a list of directories - anyway, I used this (from CAB) to get a list of all directories:

Code: [Select]
  (defun Get_Subs (folder / file) ;; CAB
    (mapcar
      (function
        (lambda (x) (setq file (strcat folder "\\" x))
          (cons file (apply (function append) (get_subs file)))))
      (cddr (vl-directory-files folder nil -1))))

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: the Swamp Block Library Manager?
« Reply #37 on: February 11, 2010, 02:53:14 AM »

Anyone had any difficulty with mine ... need help ... comments ?
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Hugo

  • Bull Frog
  • Posts: 422
Re: the Swamp Block Library Manager?
« Reply #38 on: February 11, 2010, 04:10:02 AM »
Hallo Ich

Auf der Deutschen Version lüft das Programm nicht richtig.
Beim einfügen passt die Skalieren nicht, sie wird nicht übernommen.
sonst ein recht Tooles Programm
Danke

Hello I

In the German version of the program is not ventilating properly.
Add When the scale does not fit, it will not be accepted.
otherwise a fairly Tools Program
Thanks

Hugo

  • Bull Frog
  • Posts: 422
Re: the Swamp Block Library Manager?
« Reply #39 on: February 11, 2010, 04:15:00 AM »
Hallo jbuzbee

Get the following error

Command: (LOAD "C:/Dokumente und Einstellungen/Dober.LAND/Eigene
Dateien/SwampBlockMananger/SwampBlockMananger.LSP") ; error: syntax error

Command: *Cancel*


Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: the Swamp Block Library Manager?
« Reply #40 on: February 11, 2010, 05:48:15 AM »
Can I get some info from international users ...
I have used
;;;-------------------------------------------  
;;;-------------------------------------------------------------------
;;;
   (defun _1003_InsertBlock (/ lay tmp)
      (setq tmp
              (vl-cmdf "._-INSERT"
                       (vl-string-subst "\\" "\\\\" (cdr (assoc "Block" G1003-InsertData)))
                       "S"  
                       (atof (cdr (assoc "Scale" G1003-InsertData)))
                       "R"
                       (atof (cdr (assoc "Rotation" G1003-InsertData)))
                       pause
              )
;; < ...... snip >

should this be changed to
;;;-------------------------------------------  
;;;-------------------------------------------------------------------
;;;
   (defun _1003_InsertBlock (/ lay tmp)
      (setq tmp
              (vl-cmdf "._-INSERT"
                       (vl-string-subst "\\" "\\\\" (cdr (assoc "Block" G1003-InsertData)))
                       "_Scale"  ;<<<--------******************************
                       (atof (cdr (assoc "Scale" G1003-InsertData)))
                       "_Rotate" ;<<<--------******************************
                       (atof (cdr (assoc "Rotation" G1003-InsertData)))
                       pause
              )
;; < ...... snip >

to work correctly in international Versions  ??


[added]
looks like I missed this as well  :oops:
vl-cmdf "._chprop" (entlast) "" "LA" lay "") ;<<==== "LA" Should be changed to "_LA" :-
vl-cmdf "._chprop" (entlast) "" "_LA" lay "")
« Last Edit: February 11, 2010, 06:22:02 AM by Kerry Brown »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: the Swamp Block Library Manager?
« Reply #41 on: February 11, 2010, 06:11:01 AM »
Kerry,

I always put something like

Code: [Select]
(vl-cmdf "_.-insert" ...  "[color=red]_[/color]S" ... "[color=red]_[/color]R")

With every command call I use, as it should account for other languages this way  :-)

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: the Swamp Block Library Manager?
« Reply #42 on: February 11, 2010, 06:13:56 AM »

Hi Lee,
I usually do as well ... seemed to have missed it here :(

May resolve an issue Hugo has with inserting ( hopefully )

Thanks
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: the Swamp Block Library Manager?
« Reply #43 on: February 11, 2010, 06:18:19 AM »

Hi Lee,
I usually do as well ... seemed to have missed it here :(

May resolve an issue Hugo has with inserting ( hopefully )

Thanks


No worries  :-)

Oh, and remember the '-' on the insert command, can sometimes cause a problem if not used  :wink:

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: the Swamp Block Library Manager?
« Reply #44 on: February 11, 2010, 06:45:21 AM »
The insert module will change to this in the next build
Change it in your source in the mean time.
Code: [Select]
;;;-------------------------------------------------------------------
;;;
   (defun _1003_InsertBlock (/ lay tmp)
      (if (vl-cmdf "._-INSERT"
                   (vl-string-subst "\\" "\\\\" (cdr (assoc "Block" G1003-InsertData)))
                   "_S"
                   (atof (cdr (assoc "Scale" G1003-InsertData)))
                   "_R"
                   (atof (cdr (assoc "Rotation" G1003-InsertData)))
                   pause
          )
         (progn (if (/= "" (setq lay (cdr (assoc "Layer" G1003-InsertData))))
                   (vl-cmdf "._chprop" (entlast) "" "_LA" lay "")
                )
                (if (= 1 (cdr (assoc "Explode" G1003-InsertData)))
                   (vl-cmdf "._explode" (entlast))
                )
         )
         (alert "Ooooops .. error in  '_1003_InsertBlock' Function")
      )
   )
  
;;;-------------------------------------------------------------------
;;;


[edit: Source and attachment in post#21 updated ]
--------------------------------
Original Build_06:2010.0210.19:00
--------------------------------
Build_07:2010.0211.23:45
Replaced module _1003_InsertBlock
--------------------------------
« Last Edit: February 11, 2010, 07:50:53 PM by Kerry Brown »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.