Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Active Member
porkin
Posts: 9
Registered: ‎02-06-2005
Message 1 of 10 (333 Views)

Simplest Offset command, in AutoLISP?

333 Views, 9 Replies
02-06-2005 07:27 PM
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.
*Adesu
Message 2 of 10 (333 Views)

Re: Simplest Offset command, in AutoLISP?

02-06-2005 08:22 PM 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.
Distinguished Contributor
krispy
Posts: 316
Registered: ‎11-01-2004
Message 3 of 10 (333 Views)

Re: Simplest Offset command, in AutoLISP?

02-06-2005 09:19 PM in reply to: porkin
as a function:
[code]
(defun c:myOffset()
(command "._offset")
(princ)
)
[/code]
Active Member
porkin
Posts: 9
Registered: ‎02-06-2005
Message 4 of 10 (333 Views)

Re: Simplest Offset command, in AutoLISP?

02-07-2005 08:17 AM 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)???
Active Member
porkin
Posts: 9
Registered: ‎02-06-2005
Message 5 of 10 (333 Views)

Re: Simplest Offset command, in AutoLISP?

02-07-2005 12:23 PM 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.
Distinguished Contributor
krispy
Posts: 316
Registered: ‎11-01-2004
Message 6 of 10 (333 Views)

Re: Simplest Offset command, in AutoLISP?

02-07-2005 01:52 PM 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
Active Member
porkin
Posts: 9
Registered: ‎02-06-2005
Message 7 of 10 (333 Views)

Re: Simplest Offset command, in AutoLISP?

02-07-2005 02:55 PM 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)
*David Cowie
Message 8 of 10 (333 Views)

Re: Simplest Offset command, in AutoLISP?

02-07-2005 04:30 PM 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)
Active Member
porkin
Posts: 9
Registered: ‎02-06-2005
Message 9 of 10 (333 Views)

Re: Simplest Offset command, in AutoLISP?

02-08-2005 08:20 AM 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?
Active Member
porkin
Posts: 9
Registered: ‎02-06-2005
Message 10 of 10 (333 Views)

Re: Simplest Offset command, in AutoLISP?

02-08-2005 08:28 AM 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.
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.