Mid of 2 points for block placement lisp

Mid of 2 points for block placement lisp

sludwig5GKXN
Participant Participant
565 Views
3 Replies
Message 1 of 4

Mid of 2 points for block placement lisp

sludwig5GKXN
Participant
Participant

I want to be able to run a lisp to where anytime I go to place a specific block it will run the mid between two point command 

0 Likes
Accepted solutions (1)
566 Views
3 Replies
Replies (3)
Message 2 of 4

SAPER59
Advocate
Advocate

But you want to select both points or detect them automaticaly before defining the mid point between them?

 

0 Likes
Message 3 of 4

Sea-Haven
Mentor
Mentor

(setq mp (mapcar '* (mapcar '+ p1 p2) '(0.5 0.5))) 

0 Likes
Message 4 of 4

Kent1Cooper
Consultant
Consultant
Accepted solution

If always at scales of 1 and rotation of 0:

 

(defun C:IBM () ; = Insert Block at Middle of 2 points

  (command "_.insert" "YourBlockName" "_m2p" pause "" "" "")

  (princ)

)

 

If the Block is defined for uniform scaling, omit one "".  If you want to be left to do the scales and rotation differently for each insertion, omit all the ""s at the end, and you will be left in the command at the X scale prompt.

 

Curiously, though using _m2p mode requires two picks, only one pause in the code covers both of them.

Kent Cooper, AIA
0 Likes