You are here:

AutoCAD/insert block between two points via autolisp

Advertisement


Question
how can i insert a block via autolisp(autocad2004) between two points(give x,y,z),and insert pointnumber as text near of points,
sample: insert blockname, x1,y1,z1, ponitnumber1, x2,y2,z2, ponitnumber2

Answer
Mehdi:
What version of AutoCAD are you running?
What methods have you tried so far?
(setq p1 (getpoint "\nFirst Point:  "))
(setq p2 (getpoint "\nSecond Point:  "))
(setq ang (angle p1 p2))
(setq dst (distance p1 p2))
(setq midpt (polar p1 ang (/ dst 2)))
(command "_.-insert" "blockname" midpt "" "" "")

If you need help with the rotation, do a follow-up on this question.

Keep in touch
Bill DeShawn
http://my.sterling.net/~bdeshawn

AutoCAD

All Answers


Answers by Expert:


Ask Experts

Volunteer


Bill DeShawn

Expertise

I can address all 2-D questions and some 3-D questions. I do programming in AutoLISP if it doesn`t involve solid modeling. I can also address menu customization issues and can help you find answers to questions I can`t answer by taking your question directly to Autodesk via their newsgroups.

Experience

I used to do electronic and mechanical design for a flat panel monitor manufacturer, and now I do architectural drafting for an architect. I did and do AutoLISP and menu customization and take pride in making my lisp routines to do the work exactly the way the client likes them done.

Publications
I had a routine published in CADENCE magazine (no longer in publication and taken over by CADALYST). Some of my routines are published on my website at http://my.sterling.net/~bdeshawn

©2012 About.com, a part of The New York Times Company. All rights reserved.