Jump to content

Recommended Posts

Posted

I have seen this done in the past at other firms. I am trying to insert a block on a wall using only a pickbox (one step). I am fairly new to lisp routines. I can get the block to insert fine, but I then am having trouble with the rotation. I would like the pickbox to determine the rotation automatically based off of the side of the line I pick, I currently have it asking for the rotation. If I pick on top of a line, the block faces up, if I pick the bottom, the block faces down.

Posted

Is this what you mean .... ?

 

(defun c:Test (/ p d)
 (vl-load-com)
;;; Tharwat 11.04.2012 ;;;
 (if (and (setq p (entsel "\n Select a line :"))
          (eq (cdr (assoc 0 (entget (car p)))) "LINE")
     )
   (command "_.-insert"
            <lockname>
            (vlax-curve-getclosestpointto (car p) (cadr p))
            ""
            ""
            ""
   )
 )
 (initget "Yes No")
 (if (eq (setq d (getkword "\n Agree with this direction [Yes/No] :"))
         "No"
     )
   (vla-put-rotation
     (vlax-ename->vla-object (entlast))
     (+ (/ pi 2.)
        (angle (cdr (assoc 10 (entget (car p))))
               (cdr (assoc 11 (entget (car p))))
        )
     )
   )
 )
 (princ)
)

  • 1 year later...
Posted

i think that is close. where do i place my block name in the code? "E-Po Duplex Wall"

Posted

Easiest way only 1 pick do not need a direction been doing this for years placing blocks on walls you just pick what is known as left side this way you always know which way is the inside. You get used to picking the wrong side, the right, when placing on a TOP line. The sides again top & bottom, left,right are both left picks.

 

replace with your block name its just a typo no B

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