Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Simplest Offset command, in AutoLISP?

9 REPLIES 9
Reply
Message 1 of 10
porkin
2398 Views, 9 Replies

Simplest Offset command, in AutoLISP?

My understanding of AutoLISP is very rudimentary.

I am trying to develop a simple customization of the OFFSET command.

Could someone please post here the most basic AutoLISP substitute for the built-in OFFSET comand that they know how to create?
I don't even know what program setup parameters or such that AutoLisp requires to consider a routine to be valid.

If someone could just post a real simple routine so I can have a place to start tinkering, I feel I have a chance of getting something out of this. I'd really appreciate it; I have downloaded all the other routines I used at my last employment, but never had access to copying for my own use -- all but this last one I am trying to develop myself.
Thanks in advance.
9 REPLIES 9
Message 2 of 10
Anonymous
in reply to: porkin

Hi porkin, like this may be (command "_offset" 2 pause pause "") porkin wrote in message news:5479770.1107746894333.JavaMail.jive@jiveforum1.autodesk.com... > My understanding of AutoLISP is very rudimentary. > > I am trying to develop a simple customization of the OFFSET command. > > Could someone please post here the most basic AutoLISP substitute for the built-in OFFSET comand that they know how to create? > I don't even know what program setup parameters or such that AutoLisp requires to consider a routine to be valid. > > If someone could just post a real simple routine so I can have a place to start tinkering, I feel I have a chance of getting something out of this. I'd really appreciate it; I have downloaded all the other routines I used at my last employment, but never had access to copying for my own use -- all but this last one I am trying to develop myself. > Thanks in advance.
Message 3 of 10
krispy
in reply to: porkin

as a function:
[code]
(defun c:myOffset()
(command "._offset")
(princ)
)
[/code]
Message 4 of 10
porkin
in reply to: porkin

Ok, thanks Krispy -- but I guess OFFSET is more difficult to understand than I thought. I don't see where that routine gets its keyboard input, for one thing. The other thing is, it won't load, but says it does; system will not respond to the defined name OR the name it inexplicably says the routine was loaded to respond to:

Command: ap
APPLOAD AutoDesk OFF.lsp successfully loaded.

Command: myoffset
Unknown command "MYOFFSET". Press F1 for help.

Command: off
Unknown command "OFF". Press F1 for help.

... so then I type OFFSET, and the built-in thing turns out to still be available, but the idea is to make a simple half-offset and double-offset.

Can anyone tell me why this thing won't load (or just write a half-offset, since AutoLISP is looking more opaque than even I gave it credit for)???
Message 5 of 10
porkin
in reply to: porkin

O ya, BTW, I used other comman-line entries to invoke the routine, such as the lisp filename (on disk), and everything gets me back a "unknown command" response.

What might be best is the simplest routine that would follow an "undefine" statement at the top of the file; thinking that maybe the program logic would be more transparent that way. I've come so far in getting my library decked out with routines I really value, ANYTHING that gets me to my modified-OFFSET routine is greatly appreciated.
Message 6 of 10
krispy
in reply to: porkin

type this at the command line:
(defun c:myoffset() (command "._offset") (princ))
then type:
myoffset
should run the offset command.
also note that when you load a lisp it only loads into the current drawing, so if you switch to another drawing it wont be available in that drawing, only in the original
Message 7 of 10
porkin
in reply to: porkin

Yes, that works! (dunno why apploader ain't gittin it)

Now, what do I multiply by 2 to have the function double the distance at which each offset occurs? (I dont see a variable)
Message 8 of 10
Anonymous
in reply to: porkin

Try this, it is set to multiply the offset distance by 5 but can easily be modified. "porkin" wrote in message news:12601583.1107816980424.JavaMail.jive@jiveforum1.autodesk.com... > Yes, that works! (dunno why apploader ain't gittin it) > > Now, what do I multiply by 2 to have the function double the distance at > which each offset occurs? (I dont see a variable)
Message 9 of 10
porkin
in reply to: porkin

It works! Can anyone tell me why apploader doesn't seem to like this thing (looks like what might be called a User-Defined Function routine)?

I have one more Q: what variable does this "._offset" command take its offset from? I started this thread wanting an autocad offset command that offsets entities a constant factor of the user-input distance, so I think I need a variable in which the user-input distance resides while the command finishes offsetting the entities. That's why I originally asked if anybody had a replacement routine for the built-in command; i.e., one that does not itself USE a built-in autocad "offset" command.

Can someone tell me if I'm even pointed in the right direction, or am I looking down a dead-end with the previous-listed routine?
Message 10 of 10
porkin
in reply to: porkin

Oh, sorry -- I'm using IE5.1 and it seems to not be reading these message group listings quite right.

(THANKS, David!) Now THIS one works, and it looks stripped-down enough that I can easily get it to do what I wanted.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost