Jump to content

Offset Lisp


Guest balajibth84

Recommended Posts

Guest balajibth84

Hai i am using the Code for simple offset....Now want to offset "10"means i have code.But each number i want means i am pasting that code and editing that...Plz see the Below..

 

(defun c:10()
(command "offset" "10" ))

 

(defun c:75()
(command "offset" "75" ))

 

(defun c:250()
(command "offset" "250" ))

 

So Simply i want to Give 1 to 15000 numeric to this offset code.so how to insert that range here?plz help...

Edited by SLW210
Code Tags!!!!
Link to comment
Share on other sites

  • Replies 46
  • Created
  • Last Reply

Top Posters In This Topic

  • BlackBox

    7

  • ReMark

    6

  • Cad64

    6

  • jammie

    5

Top Posters In This Topic

Please don't post questions in other people's threads. If you have a question, start your own thread, and please post it in the correct area of the forum. I have moved this question to the AutoLISP forum.

Link to comment
Share on other sites

So?

(defun C:AddOff ( / str dist)
 (initget 7)
 (setq dist (getint "\nType offset dist: "))
 (setvar "OFFSETDIST" dist)
 (setq dist (itoa dist) str (strcat "(defun C:" dist "()(command \"_.OFFSET\" \"\"))"))
 (eval(read str))
 (alert (strcat "\nCommand " dist " added. Type " dist " in command line"))
 (princ)
 )

Link to comment
Share on other sites

This seems to be an exceptional useless lisp. You are disabling your ability to enter numbers for direct entry, because every time you enter a number, you will go into Offset.

 

Is it really too much trouble to enter "o" and then type the distance :shock:

Link to comment
Share on other sites

Well this is my attempt. I would prefer to call offset from the command line but who am I to question....

 

 

To start type beginOffset

 

If you enter a number between 1 & 10000 offset should start automatically

 

(defun c:beginOffset ()
 (or *unknownReactor* (setq *unknownReactor* (vlr-command-reactor nil '((:vlr-unknownCommand . createOffset)))))

 (defun createOffset (<rea> <args> / acadDoc cmd offsetDist )

   (setq acadDoc (vla-get-activedocument (vlax-get-acad-object ))
  cmd     (car <args>))
   (if
     (and
(not (equal (setq offsetDist (atoi cmd))  0.0 1e-6))
(< 1 offsetDist 10000)
)

   (progn

     (setq newCommand (strcat "(defun c:" cmd "()(command \"._OFFSET\" "cmd "))"))
     (vla-sendcommand acadDoc  (strcat newCommand " "cmd " "))))
   )
 )

 

To remove type endOffset

 

(defun c:endOffset()
 (if *unknownReactor* (vlr-remove *unknownReactor*))
 )

Edited by jammie
command name end changed
Link to comment
Share on other sites

I sometimes wonder about the requests made for code. I understand about wanting to make our jobs easier and faster but really, the time some of you gain is then wasted standing around the water cooler talking about last night's big game. LOL

Link to comment
Share on other sites

Given the frequency with which the OP demands full routines :glare:, I'm amazed that members are still giving the OP code.

 

Admittedly, (in this case) the OP has finally 'requested help' instead. :) It's about !@#% time.

Link to comment
Share on other sites

Given the frequency with which the OP demands full routines :glare:, I'm amazed that members are still giving the OP code.

 

Well, as long as he keeps getting the fish for free, he will never learn to fish for himself.

Link to comment
Share on other sites

Yes, that's more like it. Judging by the number of requests he has made in the last few weeks, he obviously needs to learn how to write code for himself. So just giving him finished programs is not really helping him. Although I've seen his other threads where you guys have tried to teach him but he just keeps coming back asking for the finished program. So, maybe he doesn't want to learn how to fish? :unsure:

Link to comment
Share on other sites

Guest balajibth84

Hai its very useful.Suppose i am using this code with one dwg ...and after i am loading this code to new dwg means once againg i want to give all values....

 

(defun c:75()
(command "offset" "75" ))

 

(defun c:250()
(command "offset" "250" ))

 

So i am asking i am giving first time 5 or 10 means its should be offset..no need i st time giving means its saved that value..its affect the flow.........so plz fix 1 to 15000.....then we will use usly..is it possible?????

Edited by SLW210
Code Tags.
Link to comment
Share on other sites

Why can you not write your words in full

Ditto... we're not teenage girls here

Also, what is 'Hai'?

 

I've got to agree with eldon in post #5... it's a useless lisp. Just enter "O" for the offset command and enter the offset distance.

Link to comment
Share on other sites

Why can you not write your words in full :cry:

 

It would almost enable people to read your demands :shock:

 

Ditto... we're not teenage girls here

Also, what is 'Hai'?

 

Reminds me of this thread:

http://www.cadtutor.net/forum/showthread.php?36734-Than-Then

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...