@mihai_bantas wrote:
Thanks a lot dkdeterding, but I have only one request if you can select the automatic profile line by LAYER NAME or COLOR.
I tried to change the code with (setq entPro (ssget "x" '((0 "LWPOLYLINE")(8 "Lung-teren"))))
... but it did not work
Anyway, thank you for the answers dkdeterding and stevor
I hadn't tested the updated code I sent. I have edited the original code to what I believe you're looking for. With helpful guidance from BeeKeeCZ!
THIS CODE IS FOR THE ASSUMPTION THAT THIS POLYLINE IS THE ONLY POLYLINE ON THIS LAYER, unless you know whether it was the first or last (or nth) polyline drawn on that layer EVERY time.. If not, at that point it would be just as easy to select the line.
Best,
~DD
(defun c:EZTABLE (/ entPro MyTable HdistPro OldOS)
;insert table from ProfileTable to adjust to length of profile polyline
(setq OldOS (getvar "Osmode"));Store snap mode
(setvar "Osmode" 0);turn off snap
(setq entPro (ssname (ssget "X" '((0 . "*POLYLINE") (8 . "Lung-teren"))) 0));Look for all polylines on that layer
(vl-load-com)
(setq HdistPro (- (car (vlax-curve-getEndPoint entPro)) (car (vlax-curve-getStartPoint entPro))));get horizontal distance of profile polyline ("car" not needed as we have stored entity name already)
(command "-table" "2" "2" "s" "ProfileTable" (list (- 0.0 26.5) 900.0));create table (2 cols / 2 "rows" (1 header 1 title))(tablestyle)(inspoint)
(command "chprop" (entlast) "" "LA" "Defpoints" "");change layer to defined place
(setq MyTable (vlax-ename->vla-object (entlast)))
(vla-setcolumnwidth MyTable 0 23.0);Col 1 width
(vla-setcolumnwidth MyTable 1 (+ HdistPro 7));Col 2 width
(vla-setrowheight MyTable 0 5.3482);Row 1 height
(vla-setrowheight MyTable 1 9.6518);Row 2 height
(vla-setrowheight MyTable 2 5.0);Row 3 height
(vla-setrowheight MyTable 3 5.0);Row 4 height
(vla-settext MyTable 0 0 "Text 1");(row/col)(row text)
(vla-settext MyTable 1 0 "Text 2");(row/col)(row text)
(vla-settext MyTable 2 0 "Text 3");(row/col)(row text)
(vla-settext MyTable 3 0 "Text 4");(row/col)(row text)
(setvar "Osmode" OldOS)
(princ)
);defun