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

0 Members and 1 Guest are viewing this topic.

Kate M

  • Guest
Simple question (indefinite points)
« on: October 18, 2007, 03:16:26 PM »
I'm trying to help somebody on the adesk forums, and got thrown by what I assume is an easy problem

Code: [Select]
;;Revcloud from spline
(defun C:RS ()
  (command "_.spline")
  (command "_.revcloud" "o" "l" "n")
  (princ)
)

How do I let the spline command finish before moving on to the revcloud, assuming I don't know how many points there will be in the spline?

(I was all proud of myself for writing it out in lisp, then realized it wasn't any different from the same steps in a macro...<sigh>... :oops:)

T.Willey

  • Needs a day job
  • Posts: 5247
Re: Simple question (indefinite points)
« Reply #1 on: October 18, 2007, 03:24:06 PM »
Code: [Select]
;;Revcloud from spline
(defun C:RS ()
  (command "_.spline")
  (while (> (getvar "CmdActive") 0)
    (command pause)
  )
  (command "_.revcloud" "o" "l" "n")
  (princ)
)
Also since you are making it available for international use (the underscore before the commands) why not carry that throughout the command calls.
Code: [Select]
;;Revcloud from spline
(defun C:RS ()
  (command "_.spline")
  (while (> (getvar "CmdActive") 0)
    (command pause)
  )
  (command "_.revcloud" "_o" "_l" "_n")
  (princ)
)
« Last Edit: October 18, 2007, 03:26:15 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.

Kate M

  • Guest
Re: Simple question (indefinite points)
« Reply #2 on: October 18, 2007, 03:26:37 PM »
Sweet. This place rocks. :-D

Notsober

  • Guest
Re: Simple question (indefinite points)
« Reply #3 on: October 18, 2007, 04:07:59 PM »
haha, i found your post!

thanks so much for this easy fix!!

Kate M

  • Guest
Re: Simple question (indefinite points)
« Reply #4 on: October 18, 2007, 04:09:23 PM »
I thought you said it didn't work?

Notsober

  • Guest
Re: Simple question (indefinite points)
« Reply #5 on: October 18, 2007, 04:10:24 PM »
go read my *edited* reply in autodesk forums....

Kate M

  • Guest
Re: Simple question (indefinite points)
« Reply #6 on: October 18, 2007, 04:12:04 PM »
Don't see any edits from the newsreader side...whatever, glad it works. :-)

Welcome to the swamp!

Notsober

  • Guest
Re: Simple question (indefinite points)
« Reply #7 on: October 18, 2007, 04:14:26 PM »
yeah, sorry...

definite props to you Kate for finding exactly what I wanted!

oh, and kudos for the guy who also thought of exactly the same thing I did and wrote something about it!

Notsober

  • Guest
Re: Simple question (indefinite points)
« Reply #8 on: October 18, 2007, 04:24:18 PM »
okay so I'm really happy that this works, but can I get a little picky too?

awesome!  :-D

How would I also have it go straight to the CLOUD layer, and automatically turn ortho and osnap OFF, then return to them being on if they were in the first place?

FYI: I'm gonna be also be making a button or right-click function out of this, any qualms?

M-dub

  • Guest
Re: Simple question (indefinite points)
« Reply #9 on: October 18, 2007, 04:29:11 PM »
FWIW, I have this macro button for adding text... Don't use it too much anymore, but I still have it.

^C^C(setq oldlayer (getvar "clayer"));-LA;S;TEXT;;DText;J;ML;\;\(setvar "clayer" oldlayer);


I'm not sure if I understand completely what you're trying to do, though.

Notsober

  • Guest
Re: Simple question (indefinite points)
« Reply #10 on: October 18, 2007, 04:32:33 PM »
FWIW, I have this macro button for adding text... Don't use it too much anymore, but I still have it.

^C^C(setq oldlayer (getvar "clayer"));-LA;S;TEXT;;DText;J;ML;\;\(setvar "clayer" oldlayer);


I'm not sure if I understand completely what you're trying to do, though.

so are you saying you have a qualm with me using the revspline function as a button?

I don't understand your reply sir, unless you posted in the wrong topic, then I understand completely.  :ugly:

M-dub

  • Guest
Re: Simple question (indefinite points)
« Reply #11 on: October 18, 2007, 04:35:20 PM »
Just thought I'd throw it in there in response to this...

How would I also have it go straight to the CLOUD layer, and automatically turn ortho and osnap OFF, then return to them being on if they were in the first place?

I can come back to it tomorrow, but my wife just beckoned... I've gotta jet!

Kate M

  • Guest
Re: Simple question (indefinite points)
« Reply #12 on: October 18, 2007, 04:37:23 PM »
Quick & dirty...with the caveats that layer CLOUD must exist, and I left out the ortho part. Mainly because I like polar so much better, and I couldn't figure out how to turn it off with a variable.

Code: [Select]
;;Revcloud from spline
(defun C:RS (/ user_layer user_os)
  (setvar user_layer (getvar "clayer"))
    (setvar "clayer" "CLOUD")
  (setvar user_os (getvar "osmode"))
    (setvar "osmode" 0)
  (command "_.spline")
  (while (> (getvar "CmdActive") 0)
    (command pause)
  )
  (command "_.revcloud" "o" "l" "n")
  (setvar "clayer" user_layer)
  (setvar "osmode" user_os)
  (princ)
)

I think M-dub is trying to teach you how to fish. (See the "About this Forum" sticky.) :wink:

However, I am learning to fish myself, so this is practice for me. We'll make you write the next one yourself. :-D

Notsober

  • Guest
Re: Simple question (indefinite points)
« Reply #13 on: October 18, 2007, 04:51:20 PM »
CLOUD layer would definitely exist, as that our company's standard C/S/A layers are dumped into every dwg we create.

this is great y'all.

I love fishing! Only I forgot to bait the hook. :|

T.Willey

  • Needs a day job
  • Posts: 5247
Re: Simple question (indefinite points)
« Reply #14 on: October 18, 2007, 04:57:07 PM »
Kate,

Ortho = OrthoMode system variable.
Tim

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

Please think about donating if this post helped you.