Author Topic: Handy way to deal with Osnaps, Draw-Dist-Move without the right click osnap pick  (Read 226 times)

0 Members and 1 Guest are viewing this topic.

sourdough

  • Bull Frog
  • Posts: 366
This is my way, although simple, is my way of giving back to The Swamp. God knows how much
this site has given me insight and learning from others like yourself. I'm sure this could be refined, but
I leave that to the real pro's. I do mostly Survey Cad work and it does save some time. I call this a
little bit of a memory exercise ..... so how many short-cut commands do you memorize?

I have been running it in my Civil 3D since 2011 only encountered it not working when there
was an option within a command to use the number 1 [Enter].

Handy snap options - draw lines-plines and move and measure distance by Mike Perry Raleigh, NC
0 sets current layer = 0
11 sets snap = endpoint
2  sets snap = nearest
3  sets snap = node"
4  sets snap = endp node intersection perpendicular
5  sets snap = endpoint node intersection insertion perpendicular nearest
6  sets snap = endpoint nearest perpendicular
7  sets snap = off
8  sets snap = endpoint apparent intersection
*  opens Osnap dialog box
L* draws a line with you pick osnaps from dialog box and continue
pl* draws a pline with you pick osnaps from dialog box and continue
m* Move a with you pick osnaps from dialog box and continue
L* draws a line with you pick osnaps from dialog box and continue
d* draws a line with you pick osnaps from dialog box and continue
prompt "\L0 will Draw line w-Point Object

Using a number 1-6 after L or PL or M or D  eg:  L1, PL1. etc does that command with those osnaps

IF ANYONE KNOWS HOW TO MAKE A OSNAP CHANGE A TRANSPARENT FUNCTION FROM WITHIN A COMMAND, I WELCOME
YOUR PROGRAMMING EXPERIENCE.




« Last Edit: August 17, 2021, 01:24:53 PM by sourdough »
LDC 2009/C3D 2010/C3D 2011/C3D 2016

Win 10 64bit

John Kaul (Se7en)

  • Administrator
  • Needs a day job
  • Posts: 9717
Interesting concept(s) I'd like to toss up a concept for consideration as well; I would like to draw a pline and set the orthomode part way through the command (a fresh take on that age-old problem). I want to turn ORTHMODE off for the first two pickpoints and then turn it on.

I'll use some of my library tools to help me assemble this concept quicker.

First, a method to save myself some typing.
Code - Auto/Visual Lisp: [Select]
  1. (defun cmd (binding body)
  2.   ;; quick and dirty command generator.
  3.   ;; allows me to build a ``(defun c:foo () ...'' proced.
  4.   ;; this is only ment to save me some typing.
  5.   ;;
  6.   ;; By: John (7) K
  7.   ;;     10.16.07 12:31:06 PM
  8.   (eval
  9.     (append
  10.       (list 'defun
  11.             (read (strcat "c:" binding))
  12.             nil) body )) )

Next, I need a `pop` utility for list manuplications.
Code - Auto/Visual Lisp: [Select]
  1. (defun list-pop (lst / ~tval ~tpop )
  2.   ;;
  3.   ;; list-pop
  4.   ;;
  5.   ;; pops an item from a list
  6.   ;;
  7.   ;; Ex (given a list: (setq lis '(1 2 3 4 5 6 7 8 9 0)));
  8.   ;;  (list-pop 'lis)
  9.   ;;  > 1
  10.   ;;  ~~> '(2 3 4 5 6 7 8 9 0)
  11.   ;;
  12.   ;; By: John K
  13.   ;;
  14.   (setq ~tval (eval lst)
  15.         val (car ~tval))
  16.   (set lst (cdr ~tval))
  17.   val )

Now the assembly.

Code - Auto/Visual Lisp: [Select]
  1. (cmd "pl" '((setq
  2.              SETTINGS-LST- '("ORTHOMODE")
  3.              SETTINGS-LST- (mapcar (function (lambda (a) (list 'setvar a (getvar a)))) SETTINGS-LST-))
  4.           (defun *error* (msg)
  5.               (command-s) (command-s)
  6.               (setq *sstack* nil)
  7.               (mapcar 'eval SETTINGS-LST-) )
  8.            (setq *sstack* (list '(setvar 'ORTHOMODE 0) '(setvar 'ORTHOMODE 0) '(setvar 'ORTHOMODE 1)))
  9.            (command "_.pline")
  10.            (while (eq 1 (logand (getvar "cmdactive") 1))
  11.                   (command pause)
  12.                   (eval (list-pop '*sstack*)))
  13.            (quit)) )

This is a very simplistic example and we can do the same thing for OSNAPS (for example) but we cannot do both (OSNAPS and ORTHOMODE) at the same time. We could fix this concept and work with association lists if there is interest.
TheSwamp.org (serving the CAD community since 2003)

Donate to TheSwamp.org