TheSwamp

CAD Forums => CAD General => Topic started by: CAB on December 05, 2003, 03:33:14 PM

Title: _offset without the snap
Post by: CAB on December 05, 2003, 03:33:14 PM
You would think there would be an easy fix for this but it eludes me.

The Offset button has the following code
Code: [Select]
^C^C_offset

I would like to turn off osnaps if they were on, run the offset & turn them back on if they were on.

I used Se7en's on/off osnaps routine to turn them off like this

Code: [Select]
^C^C(c:setosnaps 0);_offset

anything I add after the _offset is processed as input for the command.

Tried  
Code: [Select]
^C^C(c:setosnaps 0);_offset;(c:setosnaps 1)
Tried  
Code: [Select]
^C^C_offset\non

The problem with adding commands after the _offset is that it disrupts the normal operation
of the command. That is once you enter the offset distance the command repeates.
This repeat feature is lost, but i want it to repeat.

Enlighten me please. :(

CAB
Title: _offset without the snap
Post by: CADaver on December 05, 2003, 03:42:47 PM
??  I am under the impression that OSNAPs do not effect OFFSET.  Is there some reason you need to turn them off to OFFSET??
Title: _offset without the snap
Post by: Mark on December 05, 2003, 03:44:46 PM
take a look at this cab, maybe you'll get some ideas
Code: [Select]

;
; ---------------------------------------------
; selection set of offset objects.
(defun selset (/ ent1 *ss*)
  ; create an empty selection set
  (setq *ss* (ssadd))
  (setq ent1 (entlast))
  (progn
    ; start the offset command
    (command ".OFFSET")
    (while
      ; loop until the user is done with offset
      (< 0 (getvar "CMDACTIVE"))
      (command pause)
       (if
         (not (equal ent1 (entlast)))
        (progn
          ; this will get the object that was offset
          (setq ent1 (entlast))
          ; then add it 'ent1' to the selection set
          (setq *ss* (ssadd ent1 *ss*))
          ) ; progn
        ) ; if
      ) ; while
    ) ; progn
  *ss*
  ) ; defun


; --------------- MAIN FUNCTION -------------------------
(defun c:of3 (/ ln sls eachEnt lst cntr)

  (if
    (and
      ; if both are true then call 'selset'
      (setq ln (strcase (getstring "Destination Layer Name: ")))
      (tblsearch "LAYER" ln); look in dwg for layer 'ln'
      ); and
    (setq sls (selset)); call 'selset' for a selection set.
    ; else
    (alert (strcat "No Layer--> "ln" <-- Found"))
    ); if

  (if sls
    (progn
      (setq cntr 0)
      (while
        ; continue until this is nil, no more in selection set
        (setq eachEnt (ssname sls cntr))
        ; create a list of the DXF values for 'eachEnt'
        (setq lst (entget eachEnt))
        ; modify the list 'lst' with the new layer name 'ln'
        (setq lst (subst (cons 8 ln) (assoc 8 lst) lst))
        ; modify the dwg object/entity
        (entmod lst)
        (setq cntr (1+ cntr))
        ); while
      )
    ); if
  (setq sls nil); selection set
  (princ)  
  ); defun      
Title: _offset without the snap
Post by: Dent Cermak on December 05, 2003, 03:56:07 PM
If you have your snap set to "endpoint" you can end up with your offset going funny places. "Node" can mess you up too when it asks yo to select the offset side.
Title: _offset without the snap
Post by: CAB on December 05, 2003, 03:59:58 PM
Mark, will that fit in the button? :lol:  just kidding...
I'll give it a look.


CADaver, when you pick the object to offset you are then asked to pick the side to offset to.
At that time the snap become active if it is turned on.
It never fails that if I pick empty space on one side it snaps to the other.

 It has been a pebble in my shoe for a long time.:(

CAB
Title: _offset without the snap
Post by: PDJ on December 05, 2003, 04:16:27 PM
Quote from: CAB
Mark, will that fit in the button? :lol:  just kidding...
I'll give it a look.

CAB


To think a little outside the box, just take his routine and have the button load and execute it.  That's what I do.. Actually, I wrote the routine in my acad.lsp file and put the defun in the button menu..  Or somethin like that.. eheh

Paul Jordan
Title: _offset without the snap
Post by: Hangman on December 05, 2003, 04:57:19 PM
Heres some info for you to play with.

Your snaps are setup under the osmode variable.  For each snap, there is a number associated with it.   To assign several snaps but not all, you have to add the numbers together.

So, with the offset command add the following code:
(setvar "osmode" ???)    The questionmarks are where you input the numbers associated to the snaps you want.   If you want zero snaps, enter a 0.

You can actually set it up so you can hit the offset button, it will turn off the snaps, you do your offset and then it puts your snaps back the way they were just before you hit the button.  :)

Hope this helps.
Title: _offset without the snap
Post by: CAB on December 05, 2003, 05:11:56 PM
Paul, I was just kidding around with Mark, a LIPS routine is no problem.
Just seemed like a ^B or NON (None) in the right place should do it.
Paul your haven't sent me that file yet. :)

Care to share your routine or were you not referring to a Offset Routine?

Hangman, Thanks for the reply, my favorite is 175.

CAB
Title: _offset without the snap
Post by: Keith™ on December 06, 2003, 02:16:32 AM
Well my favorite is 681
Title: _offset without the snap
Post by: CAB on December 06, 2003, 08:08:05 AM
Oh no,
I can't live without 6. :)

CAB
Title: _offset without the snap
Post by: daron on December 08, 2003, 09:44:41 AM
Se7en wrote a really nice routine that acts as if you're selecting the F3 button. It might be a good routine to try hear. He might have posted it in Show Your Stuff, so look for it or ask him where it might be, if you're still interested.
Title: _offset without the snap
Post by: CAB on December 08, 2003, 10:17:29 AM
Daron,
I used his routine to turn off the snaps.

Quote
I used Se7en's on/off osnaps routine to turn them off like this


Code: [Select]
^C^C(c:setosnaps 0);_offset

The problem I am having is turning them back on without disrupting the offset routine.

CAB
Title: _offset without the snap
Post by: daron on December 08, 2003, 10:28:55 AM
Well, the problem would result from the offset not taking control back from the user. You need to finish the command, do some //'s or write a lisp to invoke from.
Title: _offset without the snap
Post by: CAB on December 08, 2003, 11:01:34 AM
Daron,

Well, I think i am stuck with the realization that a lisp is the only way.
Just need a few days and some breathing room.
Deadlines looming, I'll be MIA.

CAB