Author Topic: Simple question (indefinite points)  (Read 11832 times)

0 Members and 1 Guest are viewing this topic.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Simple question (indefinite points)
« Reply #45 on: October 18, 2007, 07:05:38 PM »
Once you start, you won't want to stop.  You will see all these little things that you do, and could be automated to save a couple of keystrokes per usage, and you will automate it.  Happened to us all!  And each one of us had to start somewhere.

Welcome to the Swamp Robert!
Tim

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

Please think about donating if this post helped you.

JohnK

  • Administrator
  • Seagull
  • Posts: 10637
Re: Simple question (indefinite points)
« Reply #46 on: October 18, 2007, 10:01:15 PM »
so what's the code for turning ortho off?

Code: [Select]
(setq user_ortho (getvar "orthomode"))
  (setvar "orthomode" 0)
???

Or am I not understanding something right?

Try this on for size. There are several variations of this but this one will serve you good for now.

[ http://www.theswamp.org/index.php?topic=51.0#top ]
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Notsober

  • Guest
Re: Simple question (indefinite points)
« Reply #47 on: October 24, 2008, 09:10:08 AM »
I hate rehashing an OLD thread... but this is where I got started in the swamp... thanks to Kate  :wink:

but, I have another question about this lisp routine.

Often when I use it, I'm in the middle of the routine and if I find that i've messed up the spline, I hit ESC - all my osnap settings reset - grrrr!

how do I write an error function, to the affect that I can make sure my osnap settings never reset. dang I hate that!


hmspe

  • Bull Frog
  • Posts: 362
Re: Simple question (indefinite points)
« Reply #48 on: October 24, 2008, 09:50:52 AM »
I'd suggest doing a search here for "error handler".  There's lots of information.  The first thread returned (started by alanjt) should point you in the right direction.  CAB's routine in post #2 would do what you want.  You'd need to change variable names -- you use 'user_os' while CAB has used 'useros'.  You'd also want to reset clayer and orthomode.  CAB's routine resets cmdecho, which you don't have in your routine.
 
Martin
"Science is the belief in the ignorance of experts." - Richard Feynman

Notsober

  • Guest
Re: Simple question (indefinite points)
« Reply #49 on: October 24, 2008, 09:53:26 AM »
thanks for the reply.

i'll go looky...

Notsober

  • Guest
Re: Simple question (indefinite points)
« Reply #50 on: October 24, 2008, 10:05:00 AM »
okay... plz help a lispidiot...

do I paste this code just anywhere within my revspline.lsp routine using notepad like this...

Code: [Select]
(defun C:RS (/ user_layer user_os user_ortho)
  (setq user_layer (getvar "clayer"))
    (setvar "clayer" "Dimensions")
  (setq user_os (getvar "osmode"))
    (setvar "osmode" 0)
  (setq user_ortho (getvar "orthomode"))
    (setvar "orthomode" 0)
  (command "_.spline")
  (while (> (getvar "CmdActive") 0)
    (command pause)
  )
  (command "_.revcloud" "o" "l" "n")
  (setvar "clayer" user_layer)
  (setvar "osmode" user_os)
  (setvar "orthomode" user_ortho)
  (princ)
)
  (defun *error* (msg)
    (if (not
          (member msg  '("console break" "Function cancelled" "quit / exit abort" "")))
       (princ (strcat "\nError: " msg))
    ) ; if
    (and user_layer (setvar "clayer" user_layer))
    (and user_os (setvar "osmode" user_os))
    (and user_ortho (setvar "orthomode" user_ortho))
    (princ)
  ) ; end error function

or what?

Alan Cullen

  • Guest
Re: Simple question (indefinite points)
« Reply #51 on: October 24, 2008, 10:13:57 AM »
Just my two bobs worth....but place your error handler above the main code...I will continue to look at your code and get back to you.

Alan Cullen

  • Guest
Re: Simple question (indefinite points)
« Reply #52 on: October 24, 2008, 10:19:43 AM »
Just a minor thought........but why are you trying to capture variables that are not being changed in the lisp....

Everything seems to hinge around this line of code.......
  (command "_.revcloud" "o" "l" "n")

I haven't tested it, so I can't really say, just seems odd. What are you trying to do?

Notsober

  • Guest
Re: Simple question (indefinite points)
« Reply #53 on: October 24, 2008, 10:33:49 AM »
when i draw the spline I don't want to have to manually turn off ortho, osnaps, and change the layer.

i want to make sure ortho is automatically turned off, well that's self-explanatory - it's supposed to be a spline. I want osnaps turned off because I'm working around alot of details and can't stand to snap to things i don't want to snap to. I like for what I do to be fully automated.

Like when I right click, on pick 'Linear Dimension' (custom menu) it automatically puts it on Dimensions layer... get it? same thing when I click 'Dynamic Text' - automatically goes to Text layer, and so on...

And after the lisp routine has finished, and has made the spline into a revcloud, I want to be sure all my snap settings revert back to where they where before I invoked the command. Because acad's stupid .revcloud lisp resets all osnap settings!
« Last Edit: October 24, 2008, 10:41:11 AM by Robert Holland »

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Simple question (indefinite points)
« Reply #54 on: October 24, 2008, 10:42:03 AM »
Do a search for CAB's PL2CLOUD.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Notsober

  • Guest
Re: Simple question (indefinite points)
« Reply #55 on: October 24, 2008, 11:18:53 AM »
Do a search for CAB's PL2CLOUD.

that doesn't help me.

I already have a lisp that does *mostly* what I need it to do... I just wanted to make it better with an error function.

besides, you can already make a revcloud out of an already existing polyline, by simply clicking REVCLOUD, right click - or from cmd line, choose Object, then pick the pline.

But I liked better the idea of freehanding a spline into a shape around all my revisions without the "boxy" look. Plus, if I need to make rev's to the rev... I can simply right click on the cloud, turn it back into a spline, edit it however I want, then turn it back into a cloud.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Simple question (indefinite points)
« Reply #56 on: October 24, 2008, 11:23:49 AM »
Simple example

Code: [Select]
(defun c:Test (/ oOs)

  (defun *error* (msg)
   
Man work gets in the way again.... see Alan posted something before I could get back and finish this..... :cry:
« Last Edit: October 24, 2008, 12:31:14 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.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Simple question (indefinite points)
« Reply #57 on: October 24, 2008, 11:30:10 AM »
Or what. 8-)
Code: [Select]
(defun C:RS (/ *error* user_layer user_os user_ortho)

  ;;  always localize this routine!!!!!
  (defun *error* (msg)
    (if (not
          (member msg  '("console break" "Function cancelled" "quit / exit abort" "" nil)))
       (princ (strcat "\nError: " msg))
    )
    (and user_layer (setvar "clayer" user_layer))
    (and user_os (setvar "osmode" user_os))
    (and user_ortho (setvar "orthomode" user_ortho))
    (princ)
  ) ; end error function
 
  (setq user_layer (getvar "clayer"))
    (setvar "clayer" "Dimensions")
  (setq user_os (getvar "osmode"))
    (setvar "osmode" 0)
  (setq user_ortho (getvar "orthomode"))
    (setvar "orthomode" 0)
  (command "_.spline")
  (while (> (getvar "CmdActive") 0)
    (command pause)
  )
  (command "_.revcloud" "o" "l" "n")
  (*error* "")
  (princ)
)
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.

Notsober

  • Guest
Re: Simple question (indefinite points)
« Reply #58 on: October 24, 2008, 11:40:29 AM »
AWESOME!!

 :love:

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Simple question (indefinite points)
« Reply #59 on: October 24, 2008, 03:57:27 PM »
Glad I could be of service.  :-)
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.