March 21, 2012 6:35 PM
Here is a useful routine that will create isometric blocks based on an existing 2D (flat) block. This is great because all that you have to do is create the one block and this routine will do the rest for you.
Here’s how:
To create another isometric view, insert the original 2D block and repeat the above steps. Also note while you are in the insert block dialog box, that as you make new isometric blocks, they are given unique names.
Link to original post at AutoCAD Tips
Pictured below: Existing 2D blocks
;;----------------------------------------------------------------------- ;; ;; Command Name - IsoBlock ;; Routine For Transforming a Block to Isometric ;; By WizMan_07Feb10 ;; ;; Version 1.0 - 11May09 ;; Version 1.1 - 06Feb10 - Added Reverse Option and Flatten(Express) ;; Version 1.2 - 07Feb10 - Fixed DText Rotation inside block(by SEANT) ;; ;; ;;----------------------------------------------------------------------- ;; ;; (defun c:isoblock (/ blok_ent counter ent_data ent_pt i sub_func *error* blk_name midtbox midtxt reverseflag rot tbox ) ;; ;;-------------------------------------------------------------------- ;; (defun to_southwest (ent_name base_pt / obj) (vla-TransformBy (setq obj (vlax-ename->vla-object ent_name)) (vlax-tmatrix (list (list (/ (sqrt 2.) 2.) (- (/ (sqrt 2.) 2.)) 0. 0.) (list (/ (sqrt (/ 2. 3.)) 2.) (/ (sqrt (/ 2. 3.)) 2.) (sqrt (/ 2. 3.)) 0. ) (list (- (/ (sqrt 3.) 3.)) (- (/ (sqrt 3.) 3.)) (/ (sqrt 3.) 3.) 0. ) (list 0. 0. 0. 1.) ) ) ) (vla-move obj (vlax-3d-point (trans (cdr (assoc 10 (entget ent_name))) ent_name 0) ) (vlax-3d-point base_pt) ) ) ;; ;;-------------------------------------------------------------------- ;; (defun to_southeast (ent_name base_pt / obj) (vla-TransformBy (setq obj (vlax-ename->vla-object ent_name)) (vlax-tmatrix (list (list (/ (sqrt 2.) 2.) (/ (sqrt 2.) 2.) 0. 0.) (list (- (/ (sqrt (/ 2. 3.)) 2.)) (/ (sqrt (/ 2. 3.)) 2.) (sqrt (/ 2. 3.)) 0. ) (list (/ (sqrt 3.) 3.) (- (/ (sqrt 3.) 3.)) (/ (sqrt 3.) 3.) 0. ) (list 0. 0. 0. 1.) ) ) ) (vla-move obj (vlax-3d-point (trans (cdr (assoc 10 (entget ent_name))) ent_name 0) ) (vlax-3d-point base_pt) ) ) ;; ;;-------------------------------------------------------------------- ;; (defun to_front (ent_name base_pt / obj) (vla-TransformBy (setq obj (vlax-ename->vla-object ent_name)) (vlax-tmatrix (list (list 1. 0. 0. 0.) (list 0. 0. 1. 0.) (list 0. 1. 0. 0.) ;mirrored (list 0. 0. 0. 1.) ) ) ) (vla-move obj (vlax-3d-point (trans (cdr (assoc 10 (entget ent_name))) ent_name 0) ) (vlax-3d-point base_pt) ) ) ;; ;;-------------------------------------------------------------------- ;; (defun to_front_southwest (ent_name base_pt / obj) (to_front ent_name base_pt) (to_southwest ent_name base_pt) ) ;; ;;-------------------------------------------------------------------- ;; (defun to_front_southeast (ent_name base_pt / obj) (to_front ent_name base_pt) (to_southeast ent_name base_pt) ) ;; ;;-------------------------------------------------------------------- ;; (defun dtr (var) (* PI (/ var 180.0)) ) ;; ;;-------------------------------------------------------------------- ;; (defun fix_txt (blk oblang / ins) (vlax-for obj (vla-item (vla-get-Blocks doc) (cdr (assoc 2 (entget blk)))) (if (eq "AcDbText" (vla-get-Objectname obj)) (progn (Setq ins (vlax-get obj 'insertionpoint)) (vla-put-upsidedown obj 0) (vla-put-ObliqueAngle obj (dtr oblang)) (vlax-put obj 'insertionpoint ins) (vla-update (vlax-ename->vla-object (entlast))) ) ) ) ) ;; ;;-------------------------------------------------------------------- ;; (defun *error* (msg) (if blok_ent (progn (load "flattensup.lsp") (acet-flatn (ssadd blok_ent (ssadd)) nil) (cond ((= sub_func (quote to_front_southwest)) (fix_txt (entlast) 30) ) ((= sub_func (quote to_front_southeast)) (fix_txt (entlast) 330) ) (t nil) ) (if reverseflag (vlax-for obj (vla-item (vla-get-Blocks doc) blk_name) (if (eq "AcDbText" (vla-get-Objectname obj)) (vla-rotate obj (vlax-3d-point midtxt) pi) ) ) ) (setq reverseflag nil) ) ) (and doc (vla-endundomark doc)) (setvar 'cmdecho 1) ) ;; ;;-------------------------------------------------------------------- ;; (setq doc (vla-get-activedocument (vlax-get-acad-object) ) ) (vla-EndUndoMark doc) (vla-StartUndoMark doc) (setvar 'cmdecho 0) ;; ;;-------------------------------------------------------------------- ;; (if (setq blok_ent (car (entsel "\n>>>...Pick a block...>>>: "))) (progn (setq ent_data (entget blok_ent)) (setq ent_pt (cdr (assoc 10 ent_data))) (setq blk_name (cdr (assoc 2 ent_data))) (to_southwest blok_ent ent_pt) (setq counter 1) (while (or (= (setq i (strcase (getstring "\rPress [SpaceBar] to Toggle View, [R]everse or Press any Letter to exit: " ) ) ) "" ) (= i "R") ) (if (/= i "R") (progn (if blok_ent (vla-delete (vlax-ename->vla-object blok_ent)) ) (setq sub_func (nth counter '(to_southwest to_southeast to_front_southwest to_front_southeast ) ) ) (entmake ent_data) (setq blok_ent (entlast)) (if reverseflag (vlax-for obj (vla-item (vla-get-Blocks doc) (cdr (assoc 2 (entget blok_ent))) ) (if (eq "AcDbText" (vla-get-Objectname obj)) (progn (vla-rotate obj (vlax-3d-point midtxt) pi) (vla-update (vlax-ename->vla-object blok_ent)) ) ) ) ) ((eval sub_func) blok_ent ent_pt) (if (< counter 3) (setq counter (1+ counter)) (setq counter 0) ) (setq reverseflag nil) ) (if (not reverseflag) (progn (setq reverseflag t) (setq rot (vla-get-rotation (vlax-ename->vla-object blok_ent))) (vla-put-rotation (vlax-ename->vla-object blok_ent) (+ rot pi) ) (vlax-for obj (vla-item (vla-get-Blocks doc) (cdr (assoc 2 (entget blok_ent)))) (if (eq "AcDbText" (vla-get-Objectname obj)) (progn (setq ins (vlax-get obj 'insertionpoint)) (setq tbox (textbox (entget (vlax-vla-object->ename obj)))) (setq midtbox (mapcar '/ (mapcar '+ (car tbox) (cadr tbox)) '(2. 2. 2.) ) ) (setq midtxt (mapcar '+ ins midtbox)) (vla-rotate obj (vlax-3d-point midtxt) pi) (vla-update (vlax-ename->vla-object blok_ent)) ) ) ) ) ) ) ) ) ) (*error* "") (princ) ) (vl-load-com) ;; ;;-------------------------------------------------------------------- ;; (prompt "\n>>>...IsoBlock.lsp is now loaded. Type 'IsoBlock' to start ...<<<" ) ;_ prompt (princ) ;;-------------------------------------------------------------------- ;; ;;WIZ_07FEB10
Posted by AutoCAD Tips
Categories: AutoLISP, AutoLISP: Creating, AutoLISP: Modify, Customization, Isometrics
Tags:
Mobile Site | Full Site
Get a free blog at WordPress.com Theme: WordPress Mobile Edition by Alex King.
hi my dear, your lisps always great, today im having a problem about a dynamic block. I have a data file include number, date and x,y coordinate. And i have the dynamic block include date and number. I need a lisp can write this date and number into dynamic block, and can put its coordinate. Do you have any tutorial or lisp to do that ? Many thanks.
By Cihangir on March 24, 2012 at 4:36 PM
Thanks for the compliment about the blog. Unfortunately, I haven’t come across many LISP routines for Dynamic blocks. My suggestion would be to post a request in a LISP forum such as http://www.cadtutor.net or http://theswamp.org. These forums are my favorite hangouts and the autodesk forums are helpful as well.
~Greg
By AutoCAD Tips on March 27, 2012 at 1:08 AM
merhaba, bu lispi çalıştıramadım nereyi kopyalayıp uzantısını değiştirsem hata verdi. neyi yanlış yapıyorum anlamadım
By cumhur on March 25, 2020 at 6:12 AM
Thanks for your very good lisp. Now I can create any isometrick object in one click.
Thanks…. that is smart lisp.
Regards,
Pither Rukka
By Pither Rukka on February 3, 2013 at 6:11 PM
Thank you for this. Saves so much drafting time. Much appreciated.
Thanks
Roy
By Roy on November 14, 2013 at 12:05 PM
hi! im a newbie. i need help. how can i use lisp? i have no idea. pls help. should i download or paste it somewhere?
By marciacarlela on May 19, 2014 at 10:52 AM
In the “About” section of the blog there is a couple of links on how to copy the code that you find online and make a .lsp file and then how to load it in a drawing.
https://autocadtips.wordpress.com/about/
Also, Lee has some good instructions on how to load them at his site: http://www.lee-mac.com/runlisp.html
~Greg
By AutoCAD Tips on May 21, 2014 at 7:20 PM
Is there a way to use this in Autocad LT?
By william on June 25, 2014 at 1:33 PM
Sorry but no – LT doesn’t use LISP
By AutoCAD Tips on June 25, 2014 at 2:09 PM
Hello Sir
Please Suggest how can match block angle in isometric view.
By Girdhar on December 21, 2014 at 11:18 PM
Hello Sir
Please Suggest how can match block angle in isometric view with 3D line.
By Girdhar on December 21, 2014 at 11:21 PM
I download codes and save file as a lisp. but does not work with progecad ? need help to make it work.
thanks.
By Mina on May 5, 2015 at 8:09 AM
I have never used ProgeCAD, so I wouldn’t be of any help. I would suggest going to some forums like http://www.cadtutor.net or http://www.theswamp.org
There might be a ProgeCAD forum, but I never deal with it so I am in the dark about it.
Sorry,
~Greg
By AutoCAD Tips on May 5, 2015 at 8:30 AM
Hi sir , while using the lisp the Osnap automatically getting OFF
By Aswin on November 6, 2017 at 6:42 AM
And also the HIGHLIGHT value is going to ‘0’.
By Aswin on November 6, 2017 at 9:44 PM
The result lines are different of length from original lines. In isodrawing autocad draw all line at same real length.
By Mauro on August 15, 2019 at 2:16 AM
Wow this made things so much easier!
The command screws up with text and hatches though (Acad 2022).
-Text: I often see text completely fine in the preview, but in the final block it’s suddenly upside down.
-Hatches: I use it often on ANSI31 hatches, but the hatch angle gets screwed up.
By Eldyo on July 13, 2021 at 3:54 AM