Jump to content

Help Please: Modify Z-coordinate & Insert Block


Recommended Posts

Posted (edited)

Hi all. I'm not sure why the below will not work. It says "Pick Point: Point or option keyword required."

 

(setq P (getpoint "Pick Point: \n")) ;; pick point

 

(setq El_mm (strcat "105100")) ;; New Elevation

 

(setq P_fixed (strcat "(list " (rtos (car p) 2 6) " " (rtos (cadr p) 2 6) " " El_mm ")")) ;; Keep x & y the same, but Modify z to New Elevation

 

(command "-insert" "C:\\Myblock\\RBlock.dwg" P_fixed "1" "1" "0") ;;; insert block at this Modified Point

Edited by barristann
  • barristann changed the title to Help Please: Modify Z-coordinate & Insert Block
Posted

Try this:

 

The values for x, y scales and rotation should be a number, not a string (Number: 1 or string: "1")

The point should be a list and not a string.

 

- Replaced your El_mm line to keep it as a number (worth doing a check if this value comes from another LISP that it is a number)

- 2 different options to calculate the point, P_fixed, the second half of the mapacar line is a good example how to set elevation to 0 (mapcar '* '(1 1 0) P))

- Insert as described above

 

 

(defun c:test ( / )
  (setq P (getpoint "Pick Point: \n")) ;; pick point
  (setq El_mm 105100)                  ;; New Elevation

  (setq P_fixed (mapcar '+ (list 0 0 El_mm) (mapcar '* '(1 1 0) P)))  ;;Point at elevation
;;or
  (setq P_fixed (list (car p) (cadr pt) EL_mm))                       ;;Point at elevation

  (command "-insert"  "C:\\Myblock\\RBlock.dwg" P_fixed 1 1 0)

)

 

  • Like 3
Posted

Perfect. It works. Thank you Steven

  • Like 1
Posted

if your want to use the point with visual lisp instead of command in Autocad you need to wrap the xyz with vlax-3D-point function.

 

(setq P_fixed (vlax-3D-point (list (car p) (cadr p) EL_mm)))

 

  • Like 2
Posted

I'll be sure to make a note of this. Thank you mhupp.

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