Author Topic: In need of a handout. Please.  (Read 5835 times)

0 Members and 1 Guest are viewing this topic.

daron

  • Guest
In need of a handout. Please.
« on: March 17, 2005, 09:18:51 AM »
I am using a program in autocad that the original creator not only ecrypted the file but didn't collect any variables to return to their original state. What I'm in need of is an event module that collects the current layer when a lisp is called and restores that layer when the lisp is ended or cancelled. Will someone please throw out a bone with some meat on it. Thanks.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
In need of a handout. Please.
« Reply #1 on: March 17, 2005, 09:24:11 AM »
Could you wrap it ?

defun new-command
 
trap variables

call old-defunct-crappy0command

restore vars'
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

--> Donate to theSwamp<--

CmdrDuh

  • Automatic Duh Generator
  • King Gator
  • Posts: 4039
In need of a handout. Please.
« Reply #2 on: March 17, 2005, 10:12:28 AM »
can you un-encrypt it?, also, what does it do, can we replicate it fairly easily
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second

daron

  • Guest
In need of a handout. Please.
« Reply #3 on: March 17, 2005, 10:48:53 AM »
I have gotten it unencrypted. There are a bunch of functions without a c: prompt and a bunch of code without a defun. It's a HUGE file. My problem is I'm not sure about encryption. How does autocad differentiate between an encrypted file and an unencrypted file or does that matter? I'm in process of creating a whole new program for this job, but it's a slow process. I just was hoping for a bandage for what I'm currently using.

Kerry, what you mention about the wrapping it? Isn't that what beginlisp and endlisp / cancellisp do? It's the beginLisp event that I'm not sure how to write. It'd be nice if the event could be fired anytime any lisp is called.

MP

  • Seagull
  • Posts: 17498
In need of a handout. Please.
« Reply #4 on: March 17, 2005, 11:05:56 AM »
I don't mean to be a snot, but decrypting a program? Generally speaking this is a no no even though it's easy to do. Can you get the original source code from the author?
\|// Set goal. Experiment tirelessly until
|Oo| practice has become expertise.  Loop.
|- | LinkedIn | Dropbox

daron

  • Guest
In need of a handout. Please.
« Reply #5 on: March 17, 2005, 11:16:48 AM »
I don't plan to update or even take from the original code. I just want something to keep it from setting me to layer 0 when I think I'm on a different layer.

MP

  • Seagull
  • Posts: 17498
In need of a handout. Please.
« Reply #6 on: March 17, 2005, 11:20:04 AM »
Am I oversimplifying it by suggesting (command ".layerp")?
\|// Set goal. Experiment tirelessly until
|Oo| practice has become expertise.  Loop.
|- | LinkedIn | Dropbox

daron

  • Guest
In need of a handout. Please.
« Reply #7 on: March 17, 2005, 11:21:19 AM »
Where? Yes. I don't care what the previous layer was, I just want to not be left on a layer I wasn't on. Why can't people who charge for code write code that plays nice?

MP

  • Seagull
  • Posts: 17498
In need of a handout. Please.
« Reply #8 on: March 17, 2005, 11:21:46 AM »
After?
\|// Set goal. Experiment tirelessly until
|Oo| practice has become expertise.  Loop.
|- | LinkedIn | Dropbox

daron

  • Guest
In need of a handout. Please.
« Reply #9 on: March 17, 2005, 11:24:32 AM »
Was in process of editing last post as you posted. See previous post.

MP

  • Seagull
  • Posts: 17498
In need of a handout. Please.
« Reply #10 on: March 17, 2005, 11:26:11 AM »
Charging for code does not a professional make?
\|// Set goal. Experiment tirelessly until
|Oo| practice has become expertise.  Loop.
|- | LinkedIn | Dropbox

daron

  • Guest
In need of a handout. Please.
« Reply #11 on: March 17, 2005, 11:39:25 AM »
Very true. Can a vba wrapper be created for this problem?

MP

  • Seagull
  • Posts: 17498
In need of a handout. Please.
« Reply #12 on: March 17, 2005, 11:48:47 AM »
I was under the impression it was a lisp program?

Perhaps something like ...

Code: [Select]
(defun c:Wrap ( / vars )

    (setq vars
        (mapcar
           '(lambda (varname) (cons varname (getvar varname)))
           '("cmdecho" "clayer" "cecolor" "celtype")
        )        
    )
   
    (c:CallTheOffendingProgram)
   
    (foreach pair vars
        (vl-catch-all-apply
           '(lambda ()
                (setvar (car pair) (cdr pair))
            )
        )    
    )
   
    (princ)

)
\|// Set goal. Experiment tirelessly until
|Oo| practice has become expertise.  Loop.
|- | LinkedIn | Dropbox

MP

  • Seagull
  • Posts: 17498
In need of a handout. Please.
« Reply #13 on: March 17, 2005, 12:09:54 PM »
If the code runs on load you could do something like this ...

Code: [Select]
(defun c:Wrap ( / vars )

    (setq vars
        (mapcar
           '(lambda (varname) (cons varname (getvar varname)))
           '("cmdecho" "clayer" "cecolor" "celtype")
        )        
    )
   
    (load "TheOffendingProgram" (princ "The load failed."))
   
    (foreach pair vars
        (vl-catch-all-apply
           '(lambda ()
                (setvar (car pair) (cdr pair))
            )
        )    
    )
   
    (princ)

)
\|// Set goal. Experiment tirelessly until
|Oo| practice has become expertise.  Loop.
|- | LinkedIn | Dropbox

daron

  • Guest
In need of a handout. Please.
« Reply #14 on: March 17, 2005, 12:12:41 PM »
It is a lisp program that is the offender, but I was under the impression that vba could handle events better than lisp. Would I have to know each lisp name to watch for? Nice code by the way.