Hi i have a drawing with 23 polylines . I have to export the coordinates to tables with area at the end. On each vertex of the polyline is a block attibiute (not the same attriute on each vertex)
I upload a sample with one polyline for example.
I am searching for a lisp to select the polyline ,pick the start point and export the attribiute coordinates with the number of each attriute. look the test .dwg
Thanks
And if it possible to add a merge line before area to add this typeCode - Auto/Visual Lisp: [Select]
E=1/2 S(Xi + Xi+1)(Yi - Yi+1)
Thanks
You said to do ths changeCode - Auto/Visual Lisp: [Select]
i didCode - Auto/Visual Lisp: [Select]
Please you fix error at Line24?
I do not understand, can you fix at line24. Where You close first-for and Second-For?
Why you use both row=row+1? You see at line23 and line31.OK. Attached is revised lisp and your original drawing. The drawing contains a tableCode - Auto/Visual Lisp: [Select]
#region rh_amt t_obj=vla.addtable(spc,vlax.3d_point(ipt), vla.put_regeneratetablesuppressed(t_obj,vlax_true); vla.settextstyle(t_obj,acDataRow+acHeaderRow+acTitleRow,"TOPOCAD"); for(row=1;row<rows;row=row+1) cell= (cell+1); }; row= (row+1); row= (row+1); }; }; vla.put_regeneratetablesuppressed(t_obj, vlax_false); */ ) %include=vl_load_com #endregion
Select Closed LWPolyline :
Select Start Point :
Enter Area Name : "https://sdaromania.clickmeeting.com/394199842/ended"
An Error : no function definition: GETPROPERTYVALUE occurred.
Command:
Automatic save to
"Automatic Tester for Software"
I try fill the table with web-link adresses. :sleezy:
;;;https://www.theswamp.org/index.php?topic=56230.0
(defun rh:yn (msg default / tmp) (initget 6 "Yes No") (cond ( (getkword (strcat msg " [Yes/No] < " default " > : "))) (default)))
(defun rh:pchk (vlst pt fz / tmp) (while (not (equal pt (car vlst) fz)) (setq tmp (car vlst) vlst (append (cdr vlst) (list tmp)))))
(defun rh:pcw-p ( obj / tmp flg)
(if (= (type obj) 'ENAME) (setq obj (vlax-ename->vla-object obj)))
(cond ( (vlax-method-applicable-p obj 'offset)
(setq tmp (car (vlax-invoke obj 'offset -0.005))
flg (if (> (vlax-get tmp 'area) (vlax-get obj 'area)) T nil)
);end_setq
(vla-delete tmp)
flg
)
(t "")
);end_cond
);end_defun
(vl-load-com)
;;Polyline Area Table
(defun C:PAT ( / *error* sv_lst sv_vals c_doc c_spc acc iunits dut aut ccf acf fuzz flg ent pt obj cw ss cnt ent nme vlst bent tlst)
(defun *error* ( msg )
(mapcar 'setvar sv_lst sv_vals)
(if (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*EXIT*")) (princ (strcat "\nAn Error : " msg " occurred.")))
(princ)
);end_local_*error*_defun
(setq sv_lst (list 'cmdecho 'osmode 'dynprompt 'dynmode)
sv_vals (mapcar 'getvar sv_lst)
c_doc (vla-get-activedocument (vlax-get-acad-object))
c_spc (vlax-get-property c_doc (if (= 1 (getvar 'cvport)) 'paperspace 'modelspace))
acc (getvar 'luprec)
);end_setq
(cond ( (= (setq iunits (getvar 'insunits)) 6) (setq dut "m" aut (strcat "sq." dut) ccf 1.0 acf 1.0 fuzz 0.001)); CHANGE so dut=distance & aut=Area
( (= iunits 4)
(setq dut "mm" aut (strcat "sq." dut) ccf 1.0 acf 1.0 fuzz 1.0); CHANGE dut & aut
(if (= (rh:yn "\nInsertion Units are Millimetres. Convert Areas & Coordinates to Metres : ?" "No") "Yes")
(setq dut "m" aut (strcat "sq." dut) ccf 1000.0 acf 1.0e6); CHANGE dut & aut
);end_if
)
(t (setq iunits nil ccf 1.0 acf 1.0 fuzz 1.0))
);end_cond
(mapcar 'setvar sv_lst '( 0 1 3 1))
(while (not flg)
(setq ent (car (entsel "\nSelect Closed LWPolyline : "))
obj (vlax-ename->vla-object ent)
);end_setq
(cond ( (= (cdr (assoc 0 (entget ent))) "LWPOLYLINE")
(setq pt (reverse (cdr (reverse (getpoint "\nSelect Start Point : "))))
vlst (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget ent)))
);end_setq
(cond ( (equal (car vlst) (last vlst) fuzz)
(setq vlst (reverse (cdr (reverse vlst))))
(if (= :vlax-false (vlax-get-property obj 'closed)) (vlax-put-property obj 'closed :vlax-true))
(setq flg T cw (rh:pcw-p ent))
)
( (= :vlax-true (vlax-get-property obj 'closed)) (setq flg T cw (rh:pcw-p ent)))
(t (alert "NOT a CLOSED LWPolyline"))
)
(if (not cw) (setq vlst (reverse vlst)))
)
(t (alert "NOT a LWPolyline"))
);end_cond
);end_while
(setvar 'osmode 0)
(setq vlst (rh:pchk vlst pt fuzz))
(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(setq blksObj (vla-get-blocks doc))
(vla-endundomark doc)
(vla-startundomark doc)
(setq spc (vla-get-modelspace doc))
(cond (flg
(setq nme (strcase (getstring "\nEnter Area Name : "))
tlst (cons (list (strcat "E{\\H0.8x;" nme "} = " (rtos (/ (vlax-curve-getarea ent) acf) 2 2) " " aut)) tlst)
tlst (cons (list "E=1/2 S(Xi + Xi+1)(Yi - Yi+1)") tlst)
ss (ssget "F" vlst '((0 . "INSERT") (66 . 1)))
);end_setq
(repeat (setq cnt (sslength ss))
(setq bent (ssname ss (setq cnt (1- cnt))));;; ("34" "161.028" "199.985")
(setq atts (vlax-invoke
(setq blk (vlax-ename->vla-object bent))
'getattributes
)
)
(foreach att atts
;;; (setq att (CAR atts))
(cond
(
(eq (vla-get-tagstring att) "POINT")
(setq elev (vla-get-textstring att))
)
)
)
(setq pt (vlax-get blk 'insertionpoint))
(setq tlst (cons (list elev
(rtos (car pt) 2 acc)
(rtos (cadr pt) 2 acc)
)
tlst
)
);end_setq
);end_repeat
(setq tlst (cons (list "A/A" (strcat "X" (if iunits (strcat " (" dut ")") " (?)")) (strcat "Y" (if iunits (strcat " (" dut ")") " (?)"))) tlst)); CHANGE column headers
(rh:AMT c_spc (strcat "TABLE " nme) tlst)
)
(t (alert "No Polyline Selected"))
);end_cond
(mapcar 'setvar sv_lst sv_vals)
(princ)
);end_defun
(defun rh:AMT ( spc title lst / ipt t_obj rows cols row cell rdat)
(setq ipt (getpoint "\nSelect Table Insertion Point: ")
t_obj (vla-addtable spc (vlax-3d-point ipt) (1+ (length lst)) (length (car lst)) 5.0 22.5)
);end_setq
(vla-put-regeneratetablesuppressed t_obj :vlax-true)
(mapcar '(lambda (x y) (vlax-put-property t_obj x y)) (list 'horzcellmargin 'vertcellmargin 'rowheight) (list 0.5 0.5 5.0))
(vla-settextstyle t_obj (+ acDataRow acHeaderRow acTitleRow) "TOPOCAD")
; Title row
(vlax-invoke t_obj 'setrowheight 0 10.0)
(vlax-invoke t_obj 'setcelltextheight 0 0 2.5)
(vlax-invoke t_obj 'settext 0 0 title)
(setq rows (- (vlax-get t_obj 'rows) 2)
cols (1- (vlax-get t_obj 'columns))
row 1
cell 0
);end_setq
; loop through data cells
(while (< row rows)
(setq rdat (nth (- row 1) lst))
(while (<= cell cols)
(vlax-invoke t_obj 'setcelltextheight row cell 2.5)
(vlax-invoke t_obj 'settext row cell (nth cell rdat))
(vlax-invoke t_obj 'setcellalignment row cell acMiddleCenter)
(setq cell (1+ cell))
);end_while
(setq row (1+ row) cell 0)
);end_while
(repeat 2
(vlax-invoke t_obj 'setrowheight row 6.0)
(vlax-invoke t_obj 'mergecells row row 0 cols)
(setq rdat (nth (1- row) lst))
(vlax-invoke t_obj 'setcelltextheight row 0 2.5)
(vlax-invoke t_obj 'settext row 0 (car rdat))
(setq row (1+ row))
);end_repeat
(vla-put-regeneratetablesuppressed t_obj :vlax-false)
);end_defun
I got this error isInside AutoCad.exeCode: [Select]Select Closed LWPolyline :
I try fill the table with web-link adresses. :sleezy:
Select Start Point :
Enter Area Name : "https://sdaromania.clickmeeting.com/394199842/ended"
An Error : no function definition: GETPROPERTYVALUE occurred.
Command:
Automatic save to
"Automatic Tester for Software"
(snapshot.gif "cl_aclayer_enttable_2020_pp_tablegreece-vlax.gif")
(setq pt (getpoint))
(setq ss (ssget pt (list (cons 0 "insert"))))
(entget (ssname ss 0))
Block selection by fenceStep01) I add inside maxp and minp and calculateIterator between line07...line11
;;; ss (ssget "F" vlst '((0 . "INSERT") (66 . 1)))
Ok Dlanor i will wait . Thanks
An Error : too many arguments occurred.
Block selection by fenceStep01) I add inside maxp and minp and calculateIterator between line07...line11
;;; ss (ssget "F" vlst '((0 . "INSERT") (66 . 1)))Code - Auto/Visual Lisp: [Select]
for(elev=nil;cnt>=0;cnt=cnt-1) blk=vlax_ename2vla_object(bent),--I restore to 100%Vlisp from code-source-step01. :wideeyed2:
Step02)You will get greatEffects , If you insert Youtube/Links inside Table.
Step03)I compile the secondsource toStep04)I compile the mainsource to
- autoarom_jsldc11.lsp
- autoarom_jsdup35.lsp
- MyPin-Code for Execute 6473=pp_tablegreece_jspin15.lsp
- pp_tablegreece.lsp
I'm sorry my english is not good. If you explain on a DRAWING what you wantYour Lisp is very good and work fine.
Do you want to merge the codes?
I'm sorry my english is not good. If you explain on a DRAWING what you wantYour Lisp is very good and work fine.
Do you want to merge the codes?
Do you want to merge the codes? No. I want, if you insert many "https://www.youtube.com/xxxxx" inside table@drawing.dwg
then you will get great-true-Effects.
You fill the table@drawing.dwg with *www.youtube* & own-adresses(xxxxx), I hope you will get more happy.Thanks./
Code - Auto/Visual Lisp: [Select]
Hi Dianor one last question. I know if i want to change tab from model space to layout useCode - Auto/Visual Lisp: [Select]
I add this command before "Select Table Insertion Point " but the table insert in modelspace. How to change it to insert the table in layout ?
Thanks