chulse Posted June 10, 2010 Share Posted June 10, 2010 Given a specific block, how might I retrieve it's X, Y and Z coordinates, then move it's Z value to a specific depth (while keeping the x and y the same)? Thanks Quote Link to comment Share on other sites More sharing options...
fixo Posted June 10, 2010 Share Posted June 10, 2010 Given a specific block, how might I retrieve it's X, Y and Z coordinates, then move it's Z value to a specific depth (while keeping the x and y the same)? Thanks Something like this will helps: (command "._move" block_entity_selected "" '(0 0 0) (list 0 0 Z)) ~'J'~ Quote Link to comment Share on other sites More sharing options...
chulse Posted June 10, 2010 Author Share Posted June 10, 2010 Thanks Fixo, Perhaps I need to clarify a bit - I need to add the value of a variable "depth" to the current Z value, and set that as the new Z value. I didn't think I could do that using a command call...? Quote Link to comment Share on other sites More sharing options...
VVA Posted June 10, 2010 Share Posted June 10, 2010 then so (setq Z (getreal "\nEnter delta Z value: ")) (princ "\nSelect block") (setq ss (ssget "_:L" '((0 . "INSERT")))) (command "_.MOVE" ss "" "0,0,0" (strcat "@0,0," (rtos Z 2 15))) Quote Link to comment Share on other sites More sharing options...
fixo Posted June 10, 2010 Share Posted June 10, 2010 Thanks Fixo,Perhaps I need to clarify a bit - I need to add the value of a variable "depth" to the current Z value, and set that as the new Z value. I didn't think I could do that using a command call...? Here is Q&D example Try it also (defun C:MZ (/ elist en sset zv) (setq zv (getreal "\nEnter a Z value to add to an existing Z value: ")) (princ "\n >> Select block instance >>") (if (setq sset (ssget "_:S:E:N" '((0 . "INSERT")))) (progn (setq en (ssname sset 0)) (setq elist (entget en) ptlist (assoc 10 elist) ) (entmod (subst (cons 10 (list (car (cdr ptlist)) (cadr (cdr ptlist)) (+ (last (cdr ptlist)) zv))) ptlist elist) ) (entupd en) ) ) (princ) ) ~'J'~ Quote Link to comment Share on other sites More sharing options...
chulse Posted June 10, 2010 Author Share Posted June 10, 2010 Thanks for your help Fixo I'm sure there are better ways, but I ended up with this before the block insertion: (setq x (car pt)) (setq y (cadr pt)) (setq Z1 (caddr pt)) (setq Z2 (+ depth Z1)) (setq PT2 (list x y Z2)) Quote Link to comment Share on other sites More sharing options...
fixo Posted June 10, 2010 Share Posted June 10, 2010 Thanks for your help Fixo I'm sure there are better ways, but I ended up with this before the block insertion: (setq x (car pt)) (setq y (cadr pt)) (setq Z1 (caddr pt)) (setq Z2 (+ depth Z1)) (setq PT2 (list x y Z2)) You're welcome Happy computing ~'J'~ Quote Link to comment Share on other sites More sharing options...
chulse Posted June 10, 2010 Author Share Posted June 10, 2010 You're welcomeHappy computing ~'J'~ Ha, Let's call it "Happy LEARNING!" Thanks Quote Link to comment Share on other sites More sharing options...
BIGAL Posted June 11, 2010 Share Posted June 11, 2010 Easier still if you know the elavtion required before you insert the block just "Elevation" "Elev" and set value dont forget though set it back to 0.0 Quote Link to comment Share on other sites More sharing options...
chulse Posted June 11, 2010 Author Share Posted June 11, 2010 Easier still if you know the elavtion required before you insert the block just "Elevation" "Elev" and set value dont forget though set it back to 0.0 I don't in this case. I only know the depth below surface. The elevation is taken fromt he point on a 3D Pline - then moved below it. ...I just realized I am adding in my code where I need to subtract... Quote Link to comment Share on other sites More sharing options...
alanjt Posted June 12, 2010 Share Posted June 12, 2010 What about the Change command? Command: change Select objects: Specify opposite corner: 1 found Select objects: Specify change point or [Properties]: p Enter property to change [Color/Elev/LAyer/LType/ltScale/LWeight/Thickness/Material/Annotative]: e Specify new elevation <25.0000>: 52 Enter property to change [Color/Elev/LAyer/LType/ltScale/LWeight/Thickness/Material/Annotative]: For fun... (defun c:BEC (/ elev ss) (if (and (setq elev (getreal "\nSpecify elevation : ")) (setq ss (ssget "_:L" '((0 . "INSERT")))) ) ((lambda (i / ent) (while (setq e (ssname ss (setq i (1+ i)))) (setq ent (entget e)) (entmod (subst (reverse (cons elev (cdr (reverse (assoc 10 ent))))) (assoc 10 ent) ent)) ) ) -1 ) ) (princ) ) FYI: a double reverse for each object is incredibly inefficient, but for a 4 item list, I figured I'd do it anyway. What's life without a little whimsy? Quote Link to comment Share on other sites More sharing options...
chulse Posted June 14, 2010 Author Share Posted June 14, 2010 Interesting - always more than one way to do anything Quote Link to comment Share on other sites More sharing options...
alanjt Posted June 14, 2010 Share Posted June 14, 2010 Interesting - always more than one way to do anything Only hurts the cat. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.