Jump to content

lisp to move objects over 20in


MikeP

Recommended Posts

Im being totally lazy on this one. but what would a lisp look like to simply select an object enter the command and all it does it move the object over 20" to left?

Link to comment
Share on other sites

Simplest way:

 

(defun c:test ( / ss )
 (if (setq ss (ssget "_:L"))
   (command "_.move" ss "" "_non" '(0. 0. 0.) "_non" '(-20 0. 0.))
 )
 (princ)
)

Link to comment
Share on other sites

:lol:

 

(defun c:LazyMove ( / ss pt)
 (princ "\rI'M TOALLY LAZY ")
 (if (and (setq ss (ssget))
          (setq pt (getpoint "\nSelect base point: ")))
   (command "._move" ss "" pt (cons (- (car pt) 20.) (cdr pt)))
   (cond (ss (prompt "\n** Invalid point ** "))
         ((prompt "** Nothing selected ** "))))
 (princ))

Link to comment
Share on other sites

sorry dude, I like lees way... I dont wanna have to pick a base point.

 

No worries; I like his better too. LoL

Link to comment
Share on other sites

to help me out. I dont understand the "_:L" or the "_non" parts of the lisp.

 

The "_:L" simply ignores locked layers during the selection. The "_non" simply removes any accidental OSNAP interference.

Link to comment
Share on other sites

to help me out. I dont understand the "_:L" or the "_non" parts of the lisp.

 

Sure :)

 

"_:L" - excludes objects on Locked Layers from the SelectionSet

"_non" - 'None' OSnap, i.e. ignore ObjectSnap for the next supplied point.

Link to comment
Share on other sites

***Really?***

 

 

i have a number of objects that I have to keep moving over 20". In my head I justify laziness into efficiency.

  • Funny 1
Link to comment
Share on other sites

Sure :)

 

"_:L" - excludes objects on Locked Layers from the SelectionSet

"_non" - 'None' OSnap, i.e. ignore ObjectSnap for the next supplied point.

 

thanks, but whats is the need to ignore those type of things? if you not asking for a base point. or is it just a safety to avoid any possible future errors?

Link to comment
Share on other sites

i have a number of objects that I have to keep moving over 20". In my head I justify laziness into efficiency.

 

Its definitely justified if the time taken to write the code is less than the time saved :)

Link to comment
Share on other sites

thanks, but whats is the need to ignore those type of things? if you not asking for a base point. or is it just a safety to avoid any possible future errors?

 

I'm not prompting for a base point, but I'm still supplying the Move command with two points which may be affected by any objects surrounding those points.

Link to comment
Share on other sites

My effort an oldie chx chy chz this is stuff 15 years old

 

(defun C:CHX ()
 (SETVAR "CMDECHO" 0)
 (setq sn (getvar "osmode"))
 (command "osnap" "near")
 (setq x 0)
 (princ "\nalters object in X direction")
 (setq ht (getstring "\n What is amount of change: "))
 (setq newht (strcat ht ",0"))
 (while (= x 0)
   (setq newobj (entsel "\nPoint to object: "))
   (if (/= newobj nil)
   (progn
   (command "move" newobj "" "0,0" newht)
   ))
 (if (= newobj nil)(setq x 1))
 )
)
;
(defun C:CHY ()
 (SETVAR "CMDECHO" 0)
 (setq sn (getvar "osmode"))
 (command "osnap" "near")
 (setq x 0)
 (princ "alters object in Y direction")
 (setq ht (getstring "\n What is amount of change: "))
 (setq newht (strcat  "0," ht))
 (while (= x 0)
 (SETQ NEWobj (entsel "\nPoint to object: "))
 (if (/= newobj nil)
 (progn
 (command "move" newobj "" "0,0" newht)
 ))
 (if (= newobj nil)(setq x 1))
 )
 )

;simple routine to change objects in the z direction
(defun C:CHZ ()
 (SETVAR "CMDECHO" 0)
 (setq sn (getvar "osmode"))
 (command "osnap" "near")
 (setq x 0)
 (princ "alters object in Z direction")
 (setq ht (getstring "\n What is amount of change: "))
 (setq newht (strcat "0,0," ht))
 (while (= x 0)
 (SETQ NEWobj (entsel "\nPoint to object: "))
 (if (/= newobj nil)
 (progn
 (command "move" newobj "" "0,0,0" newht)
 ))
 (if (= newobj nil)(setq x 1))
 )
 )

Link to comment
Share on other sites

Quick Select and Move wouldn't work?

 

How many times do you have to move the same objects 20"? What type of drawing is this?

Link to comment
Share on other sites

Fyi,

In 2012 we can nudge object(s) using arrow. The distance can be determined using grid snap.

Link to comment
Share on other sites

  • 1 year later...

Hello

 

This is very usefull in my field as we design Shopping malls and use Architects drawings to quickly draw over their lines for what is needed in another location in model space then draw our own design over the traced lines.

 

Is there a way to incorporate the pline command in Lee's lisp routine so the command first starts with Pline then automatically moves the object 20 in in left direction? Again we are not lazy cad users. it only removes the extra commands for each shape you draw (especially when you are tracing over a mall floor tiles)

 

Best Regards

 

Adsk2007

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...