Author Topic: vlr-commandWillStart  (Read 17061 times)

0 Members and 1 Guest are viewing this topic.

BlackBox

  • King Gator
  • Posts: 3770
Re: vlr-commandWillStart
« Reply #30 on: March 16, 2011, 02:33:13 PM »
...
Could you provide the header attribution you'd like to be saved with this code?
...

No attribution for me personally please; I use a screen name (not my real name) because I don't deserve or want any. However I can recommend one for you to use.

How would something like below work?

No worries; I simply felt it appropriate.

I have no idea. Try deleting the Views before the pagesetups?

Sadly that will not work, as the existing page setups reference the existing named views.

Does anyone know what objects/collections (other than the deleted plot configurations) could be referencing the named views?

This is the first time I've attempted something with the named views, and haven't yet been through the entire Developer Documentation on View objects.  :?
"How we think determines what we do, and what we do determines what we get."

cadman6735

  • Guest
Re: vlr-commandWillStart
« Reply #31 on: March 16, 2011, 05:43:27 PM »
Maybe the Layout Object

Layout and PlotConfiguration seem to cross referance each other...


I really don't know, just trying my hand at the helping side vs. the question side...

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: vlr-commandWillStart
« Reply #32 on: March 16, 2011, 05:47:27 PM »
BTW, did you manage to get my initial code working in the end?

Just curious  :-)

cadman6735

  • Guest
Re: vlr-commandWillStart
« Reply #33 on: March 16, 2011, 06:39:38 PM »
Lee, is your question directed to me?

If so

No, I never got it to work, it still errors on me

Command: l LINE Specify first point:
Specify next point or [Undo]:
Specify next point or [Undo]:
Command: test
Command:
Command: l LINE ; error: An error has occurred inside the *error*
functioninvalid AutoCAD command: nil
Specify first point:
Specify next point or [Undo]:
Specify next point or [Undo]:[/quote]

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: vlr-commandWillStart
« Reply #34 on: March 16, 2011, 06:50:28 PM »
That does worry me since, for one, I can't get it to error, and it means that you have a routine with an unlocalised *error* function which also has an error inside it...

Even if you don't decide to pursue my code, I would advise you look over the routines you have loaded.

cadman6735

  • Guest
Re: vlr-commandWillStart
« Reply #35 on: March 16, 2011, 07:33:29 PM »
Why would it only error when I load your code?

I will unload all my code and then run your code again.

Time for me to learn error trapping.
I have to start sometime I suppose  :-o

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: vlr-commandWillStart
« Reply #36 on: March 16, 2011, 07:45:13 PM »
Why would it only error when I load your code?

Two reasons I can think of, assuming my correct is correct: either you have a routine with a function of the same name as used in my code, or you have a routine with an unlocalised variable called *react* (this is global in my code).

cadman6735

  • Guest
Re: vlr-commandWillStart
« Reply #37 on: March 16, 2011, 08:00:39 PM »
Well I unloaded all my code and ran yours again and I still get the same result.

But

I could have totaly broken my AutoCAD, I tinker too much.

I will worry about this tomorrow, time for me to head to the house.  I've got  6 month old that I am eager to hug.

Isn't it 1am where you are, how come you are still looking at your square box?

cadman6735

  • Guest
Re: vlr-commandWillStart
« Reply #38 on: March 17, 2011, 10:50:08 AM »
Lee

What can I say other than I am a dumb... ???   :ugly:

your code work fine and my code is fine too...


I only copied half of your code and ran it, I didn't see the drag bar and it didn't drag automaticly when I highlighted and copied it.

This is what I was running to get the error....

Code: [Select]
(defun c:test nil

  (if (not *react*)
    (setq *react*
      (vlr-command-reactor nil
        (list
          (cons :vlr-commandwillstart 'callback)
        )
      )
    )
    (progn
      (vlr-remove *react*)
      (setq *react* nil)
    )
  )

  (princ)
)



cadman6735

  • Guest
Re: vlr-commandWillStart
« Reply #39 on: March 17, 2011, 10:54:16 AM »
tell you what I like it

I could turn this into a handy tool for myself

Thanks

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: vlr-commandWillStart
« Reply #40 on: March 17, 2011, 03:43:45 PM »
I only copied half of your code and ran it, I didn't see the drag bar and it didn't drag automaticly when I highlighted and copied it.

Not a problem - glad you could get it working in the end :-)

This is what I was running to get the error....

That would indeed error since the 'callback' function is not defined in the active drawing. However, it still doesn't explain why you are receiving the message that there is an error inside the *error* function...

What happens if you start a new drawing and just force a LISP error by typing something like:

Code: [Select]
(/ 1 0)
I'm expecting:

Quote
Command: (/ 1 0)
; error: divide by zero

But if there is any mention of an error inside an *error* function it would indicate that you have a routine running which is redefining the *error* function to something erroneous.


Anyway, glad you could make use of my example.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: vlr-commandWillStart
« Reply #41 on: March 17, 2011, 03:47:57 PM »

using (VL-BT) at the command line MAY help you isolate the cause.
Code: [Select]
Command: (/ 1 0)
; error: divide by zero

Command: (vl-bt)
Backtrace:
[0.19] (VL-BT)
[1.15] (#<SUBR @000000002d6bfca0 -rts_top->)
[2.12] (#<SUBR @000000002c2c8700 veval-str-body> "(vl-bt)" T #<FILE internal>)
:CALLBACK-ENTRY.6 (:CALLBACK-ENTRY)
:ARQ-SUBR-CALLBACK.3 (nil 0)
nil
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.

cadman6735

  • Guest
Re: vlr-commandWillStart
« Reply #42 on: March 21, 2011, 10:19:35 AM »
Kerry
Thanks for your reply, I have not had the chance to study your response but I will and thank you.

But what I would like to share is what I found over the weekend, I hope this will help someone.

From the help menu of AutoCAD 2011

Quote
http://docs.autodesk.com/ACD/2011/ENU/filesALG/WS73099cc142f4875516d84be10ebc87a53f-7c14.htm

And the big find for me is, drum roll please.........

Code: [Select]
(defun s::StartUp ()
  (LoadPageSetup)
)

I added this to my acaddoc.lsp under my function load and I just call it magic.

Thanks

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: vlr-commandWillStart
« Reply #43 on: March 21, 2011, 11:25:06 AM »
I've always been advised against redefining the S::Startup symbol - I believed it was meant to be defined as a list, something like this:

Code: [Select]
(if (and S::Startup (listp S::Startup))
  (defun-q-list-set 'S::Startup (append (defun-q-list-ref 'S::Startup) '((LoadPageSetup))))
  (defun-q S::Startup nil (LoadPageSetup))
)

Untested however.

EDIT: But surely just (LoadPageSetup) in the ACADDOC.lsp will perform as needed?
« Last Edit: March 21, 2011, 11:28:59 AM by Lee Mac »

cadman6735

  • Guest
Re: vlr-commandWillStart
« Reply #44 on: March 21, 2011, 11:55:27 AM »
Hi Lee

Quote
But surely just (LoadPageSetup) in the ACADDOC.lsp will perform as needed?

I thought so too, but (LoadPageSetup) did not work for me, it kept giving me a Unknown function or I if used (command "LoadPageSetup" with a C:LoadPageSetup in my function) unknown command.  I have only ever used acaddoc.lsp to load function to run from the command prompt when I call it, I wanted this to run at start up of opening files.  I was confused why I could get default ACAD commands to work but not my own Lisp functions.  I freakin ran my brain in circles this weekend trying to figure it out.  I came across an article that was used for ACAD R14 to put (S::Startup) and it worked.  So I thought that maybe default commands and custom commands loaded and ran differently at start up.


Thanks for correcting my direction.  I guess I need to figure out why (LoadPageSetup) does not work.


---Edit---

But even though my function said unknown function or command at startup
If I ran it from the command prompt it worked.  Which lead me to believe there was something different about custom function running when files open.
Anway it is always somthing and if not something it will be something else.
« Last Edit: March 21, 2011, 12:00:16 PM by cadman6735 »