Jump to content

Subtracting from z axis to get new point


antoniusxylem

Recommended Posts

So I want to insert a block that is below the initial insertion point without changing the block. I've been busting my brain trying to get this lisp routine to work correctly. I think I'm close I get a malformed error on input. Can anybody help me out?

 

(defun C:*789 (/ oldlayer pt1 pt2)

(setq pt1 (getpoint "\nChoose a point : "))

(setq x (/ (car pt1)

(setq y (/ (cadr pt1)

(setq z (/ (caddr pt1) - 0.353))

(setq pt2 (x y z))

(command

"insert" "C:/CAD_BLOCKS/J-Hangers/J-HANGER-050.dwg" pt2 ""

""

)

(PROMPT " \ Rotation Point")

(princ)

)

)

Link to comment
Share on other sites

Welcome to CADTutor :)

 

Here are some quick corrections to your code:

(defun C:789 ( / pt1 pt2 x y z )
   (setq pt1 (getpoint "\nChoose a point : "))
   (setq x (car pt1))
   (setq y (cadr pt1))
   (setq z (- (caddr pt1) 0.353))
   (setq pt2 (list x y z))
   (command "_.-insert" "C:/CAD_BLOCKS/J-Hangers/J-HANGER-050.dwg" "_non" pt2 "" "" "\\")
   (princ)
)

For an explanation of the error, please refer to my Error Message Troubleshooter.

 

PS: Please edit your post and enclose your code with code tags:

 

[highlight][noparse]

[/noparse][/highlight] Your code here [highlight][noparse]

[/noparse][/highlight]

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