mitchy_v Posted April 11, 2012 Posted April 11, 2012 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. Quote
Tharwat Posted April 11, 2012 Posted April 11, 2012 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) ) Quote
Lee Mac Posted April 11, 2012 Posted April 11, 2012 This may help: http://lee-mac.com/autoblockbreak.html Quote
mitchy_v Posted January 16, 2014 Author Posted January 16, 2014 i think that is close. where do i place my block name in the code? "E-Po Duplex Wall" Quote
BIGAL Posted January 16, 2014 Posted January 16, 2014 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 Quote
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.