Author Topic: Error is there a solution?  (Read 27201 times)

0 Members and 1 Guest are viewing this topic.

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Error is there a solution?
« Reply #45 on: January 12, 2009, 01:08:58 PM »
I ran the updated copy and the following happens,

first it lags my machine then prompts this

Quote
; error: bad SSGET list value


I updated the code again....give it a whirl.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

cadmoogle

  • Guest
Re: Error is there a solution?
« Reply #46 on: January 12, 2009, 01:14:40 PM »
It's not prompting errors, but it's only finding the first name in the list now. :)

I just added your update and testing now, so far it's working... be right back  :lol:

cadmoogle

  • Guest
Re: Error is there a solution?
« Reply #47 on: January 12, 2009, 01:21:04 PM »
It's working and if one of the blocks listed is in the drawing exist it prompts fast, but I tested it on a normal as-built that had none of the listed blocks in the drawing, just about 20 other blocks, and it still drags  :cry:

17 seconds is the time it takes to prompt "All standard blocks found in drawing"

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Error is there a solution?
« Reply #48 on: January 12, 2009, 01:35:06 PM »
What needs to happen is what CAB said....break up the big list and ssget less times.....no time right now to do it. Sorry.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

cadmoogle

  • Guest
Re: Error is there a solution?
« Reply #49 on: January 12, 2009, 02:01:23 PM »
I broke it up into three selection sets each has around 500 is that still too much? I could further break it down into; bends, valves, etc. for each layer.

cadmoogle

  • Guest
Re: Error is there a solution?
« Reply #50 on: January 12, 2009, 02:30:15 PM »
It seems to be a little quicker, how could I have it stop running the command if it does not find any blocks with WM, SS, FM or RE in the block names? The old blocks in the drawing seem to be slowing it down, so I figured if I could find a way for it to do a quick search before continuing it might deal with the lag when misc blocks are in the drawing.

So in a nutshell, run the command,
Do a quick search, if no blocks in the drawing contain WM, SS, FM or RE in the block names continue forward to close, but if they do have it scan for the listed block names.

Do you think that would help?


Thank you for all of the help guys!

Here is the working copy with all blocks and sets in it.

dustinthiesse

  • Guest
Re: Error is there a solution?
« Reply #51 on: January 12, 2009, 03:01:01 PM »
Code: [Select]
(while
  (and
    (setq data(tblnext"block"(null data)))     ;;;while there are still blocks in the database
    (not(wcmatch(cdr(assoc 2 data))"*WM*,*SS*,*FM*,*RE*"))      ;;;and the current block name does not match the search string options
  )
)
;(if data     ;;;if it finds any matches then data is not nil
;;;continue rest of code here

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Error is there a solution?
« Reply #52 on: January 12, 2009, 03:05:38 PM »
Step through the block table, and compare the name of the block to the list.  If it's in the list, then add the block inserts ( which can be gotten from the block table record ) to an ssget variable.  Then do what you want with the ssget.
Tim

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

Please think about donating if this post helped you.

cadmoogle

  • Guest
Re: Error is there a solution?
« Reply #53 on: January 12, 2009, 03:10:01 PM »
Step through the block table, and compare the name of the block to the list.  If it's in the list, then add the block inserts ( which can be gotten from the block table record ) to an ssget variable.  Then do what you want with the ssget.

I'm not that advanced  :-P. Where would I start? The previous command would select it from the drawing, but I could never get the larger list of block names to work.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Error is there a solution?
« Reply #54 on: January 12, 2009, 03:12:39 PM »
Give this one a go.
<edit: old code removed>
« Last Edit: January 12, 2009, 03:36:29 PM 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.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Error is there a solution?
« Reply #55 on: January 12, 2009, 03:16:36 PM »
Here is what I'm talking about.

Code: [Select]
(defun GetInserts ( blkNameList / ss Data tempName tempEnt)
   
    (setq blkNameList (mapcar 'strcase blkNameList))
    (setq ss (ssadd))
    (while (setq Data (tblnext "block" (not Data)))
        (if (vl-position (setq tempName (strcase (cdr (assoc 2 Data)))) blkNameList)
            (progn
                (setq Data
                    (entget
                        (cdr
                            (assoc
                                330
                                (entget (tblobjname "block" tempName))
                            )
                        )
                    )
                )
                (foreach i (member '(102 . "{BLKREFS") Data)
                    (if
                        (and
                            (equal (car i) 331)
                            (not (vlax-erased-p (setq tempEnt (cdr i))))
                        )
                        (ssadd tempEnt ss)
                    )
                )
            )
        )
    )
    (if (> (sslength ss) 0)
        ss
        nil
    )
)
Tim

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

Please think about donating if this post helped you.

cadmoogle

  • Guest
Re: Error is there a solution?
« Reply #56 on: January 12, 2009, 03:18:39 PM »
Give this one a go.


CAB this flies  :-D but, when I test it out on this drawing it returns nils and does not continue to close. Attached is thew DWG sample.

Thank you,
Daniel


T.Willey

  • Needs a day job
  • Posts: 5251
Re: Error is there a solution?
« Reply #57 on: January 12, 2009, 03:19:59 PM »
Or one with just Lisp

Code: [Select]
(defun GetInserts ( blkNameList / ss Data tempName tempEnt)
   
    (setq blkNameList (mapcar 'strcase blkNameList))
    (setq ss (ssadd))
    (while (setq Data (tblnext "block" (not Data)))
        (if (vl-position (setq tempName (strcase (cdr (assoc 2 Data)))) blkNameList)
            (progn
                (setq Data
                    (entget
                        (cdr
                            (assoc
                                330
                                (entget (tblobjname "block" tempName))
                            )
                        )
                    )
                )
                (foreach i (member '(102 . "{BLKREFS") Data)
                    (if
                        (and
                            (equal (car i) 331)
                            (entget (setq tempEnt (cdr i)))
                        )
                        (ssadd tempEnt ss)
                    )
                )
            )
        )
    )
    (if (> (sslength ss) 0)
        ss
        nil
    )
)
Tim

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

Please think about donating if this post helped you.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Error is there a solution?
« Reply #58 on: January 12, 2009, 03:35:58 PM »
OK another version.
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.

cadmoogle

  • Guest
Re: Error is there a solution?
« Reply #59 on: January 12, 2009, 03:41:26 PM »
I swear after this my first two children are going to have to be named CAB and Ron  :-)

That worked but it is still nil on blank drawings from some reason. Qnew and run the command it should come up nil. Is that from an if statement?