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

0 Members and 1 Guest are viewing this topic.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Error is there a solution?
« Reply #60 on: January 12, 2009, 03:56:05 PM »
This was just thrown together to test for speed.
What did you want it to return? (too lazy to read the entire thread)  :-)
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 #61 on: January 12, 2009, 03:58:50 PM »
This was just thrown together to test for speed.
What did you want it to return? (too lazy to read the entire thread)  :-)


It's working great but is just getting hung up on nil if the drawing has no blocks in it. I was planning on replacing the close command with this. That would mean if the drawing had no blocks/ or none that match WM,SS, etc this would hang up on nil and not close.

ronjonp

  • Needs a day job
  • Posts: 7526
Re: Error is there a solution?
« Reply #62 on: January 12, 2009, 04:02:50 PM »
Here is a mod of T Willey's function that will quit after the first occurrence found. I'd guess that it would be super fast...but have not tested it.

Code: [Select]
(defun GetInserts ( blkNameList / imdone Data tempName tempEnt)
   
    (setq blkNameList (mapcar 'strcase blkNameList))
    (while (and (setq Data (tblnext "block" (not Data)))(not imdone))
        (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)))
                        )
                        (setq imdone T)
                    )
                )
            )
        )
    )
  (and imdone)
 
)

*tested....and it's SUPER fast...nice one Tim.
« Last Edit: January 12, 2009, 04:13:11 PM by ronjonp »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Error is there a solution?
« Reply #63 on: January 12, 2009, 04:11:36 PM »
I localized the variables which may have been the problem.

<edit: removed code with error>
« Last Edit: January 12, 2009, 04:30:07 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.

cadmoogle

  • Guest
Re: Error is there a solution?
« Reply #64 on: January 12, 2009, 04:17:27 PM »
I localized the variables which may have been the problem.



 :-o still nil on when no blocks exist or those that do not match WM, SS, FM or RE, hmm

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Error is there a solution?
« Reply #65 on: January 12, 2009, 04:24:11 PM »
<snip>


*tested....and it's SUPER fast...nice one Tim.


Thanks for testing Ron.  I figured it would be quicker to just step through one thing, that being the block table here, instead of searching the database as many times as there are block names.
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 #66 on: January 12, 2009, 04:29:36 PM »
OK, this should do it. Sorry.  :oops:
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 #67 on: January 12, 2009, 04:32:52 PM »
Thanks guys both versions are working properly. I will do some further testing but it's looking good!

cadmoogle

  • Guest
Re: Error is there a solution?
« Reply #68 on: January 12, 2009, 04:33:40 PM »
How is close all connected to close? If I replaced close would this take care of close all?

cadmoogle

  • Guest
Re: Error is there a solution?
« Reply #69 on: January 12, 2009, 04:42:16 PM »
CAB, I loaded into the startup and the old close all still function not the newclose. So I'm guessing I have to redefine....
« Last Edit: January 12, 2009, 04:46:25 PM by cadmoogle »

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Error is there a solution?
« Reply #70 on: January 12, 2009, 05:01:47 PM »
Name the lisp with (defun c:close
load it via startup and use this in a lisp that loads last
(command "undefine" "Close")
Do you have something loading at the end of startup?
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 #71 on: January 12, 2009, 05:07:34 PM »
Yep, zero width lisp. I noticed the top right X will allow the user to closeall even with the command undefined.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Error is there a solution?
« Reply #72 on: January 12, 2009, 06:48:35 PM »
I guess we are stuck. We can redefine the CLOSE, QUIT, and SAVE commands but the X out issues a .CLOSE
which skips our close routine. Although a reactor can catch the X out close the reactor can not stop the CLOSE.

Pondering a solution...  :|
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 #73 on: January 12, 2009, 07:48:58 PM »
Will then it just becomes a reminder message  :|. I've been thinking of ways I can further use it. My first thought was just to place it on the machines, but I'm worried about the user getting annoyed and removing it at will. So I could bury it in acaddoc.lisp and lock the privileges on the folder  :evil:. I've been looking at a way to create a report to a text file but I'm not having any luck. I've come across an old command from 2004 that you wrote, but I'm not sure if it would work.

Have you or anyone else you know have created some type of logging report?

Tricky, tricky...  :-(



 


CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Error is there a solution?
« Reply #74 on: January 12, 2009, 08:13:24 PM »
Output to a text file is easy once you have done one. I'll post a routine tomorrow.

What do you want to include in the output & do you want to append to an existing log file
or create a new one each time?
« Last Edit: January 12, 2009, 08:17:10 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.