Nowak Posted May 28, 2020 Share Posted May 28, 2020 (edited) Hello, I insert 3D blocks thanks to one of Patrick's lisp, which is the IXL lisp, the blocks fit very well, but there is just one problem, it's that I don't know what the angle is , so that the block is perpendicular to the polyline. So if anyone can help me clear this up, thank you in advance. Edited June 11, 2020 by Nowak Quote Link to comment Share on other sites More sharing options...
BIGAL Posted May 30, 2020 Share Posted May 30, 2020 I thought I posted this already have you double posted ? It has a hard coded test csv file you will need to change. ; Take a csv file of text details and make in Cad ; By Alan H May 2018 (defun c:Tram-posts ( / fname str newlst pt angl isblk oldsnap oldaunits ) (defun alg-ang (objpl pnt) (angle '(0. 0. 0.) (vlax-curve-getfirstderiv objpl (vlax-curve-getparamatpoint objpl pnt ) ) ) ) ; thanks to Lee-mac for this defun ; www.lee-mac.com ; 44 is comma (defun _csv->lst ( str / pos ) (if (setq pos (vl-string-position 44 str)) (cons (substr str 1 pos) (_csv->lst (substr str (+ pos 2)))) (list str) ) ) (defun dtr (a) (* pi (/ a 180.0)) ) (defun chkblk ( bname ) (setq isblk (tblsearch "BLOCK" bname)) (if (/= isblk nil) (princ) (alert (strcat "Block " bname " is missing")) ) ) ; program starts here hardcoded for testing (setq oldsnap (getvar 'osmode)) (setvar 'osmode 0) (setq oldaunits (getvar 'aunits)) (setvar 'aunits 3) (setq obj (vlax-ename->vla-object (car (entsel "Pick pline ")))) (setq newlst '()) (setq fname (open "D:\\acadtemp\\tram posts.csv" "r")) (setq newline (read-line fname)) (while (setq newline (read-line fname)) (setq newlst (cons ( _csv->lst newline) newlst)) ) (close fname) (princ) (foreach lst newlst (setq blk (nth 0 lst)) (chkblk blk) (if (and (/= isblk nil)(/= (substr blk 1 1) "")) (progn (setq dist (atof (nth 1 lst)) off (atof (nth 2 lst)) Z (atof (nth 3 lst)) ang (atof(nth 4 lst)) ) (setq pt (VLAX-CURVE-GETPOINTATDIST obj dist)) (setq angl (alg-ang obj pt)) (setq pt (polar pt angl off)) (setq pt (list (car pt)(cadr pt) z)) (command "-insert" blk pt 1 1 angl) ) ) ) (setvar 'osmode oldsnap) (setvar 'aunits oldaunits) (princ) ) Tram posts.csv Quote Link to comment Share on other sites More sharing options...
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.