Lisp for calculating geometric properties

Lisp for calculating geometric properties

rafael.bizarro
Participant Participant
3,022 Views
27 Replies
Message 1 of 28

Lisp for calculating geometric properties

rafael.bizarro
Participant
Participant

Good afternoon my friends. I really need a help to elaborate this LISP according to the step-by-step in the image below. I would be very grateful for your help. Thank you in advance.

image.png

0 Likes
Accepted solutions (2)
3,023 Views
27 Replies
Replies (27)
Message 21 of 28

rafael.bizarro
Participant
Participant
 

 

0 Likes
Message 22 of 28

rafael.bizarro
Participant
Participant

I couldn't find a way to remove these separators.

0 Likes
Message 23 of 28

Sea-Haven
Mentor
Mentor

I have read a csv create a table if you want it. But easier is make a table the 1st 3 rows heading, description, data etc then when you write line to csv just do a insertrows to table very easy.

 

; Example of how to create an Autocad Table
; By Alan H 

(defun AHMaketable (/ colwidth numcolumns numrows objtable rowheight sp vgad vgao vgms)
(vl-load-com)
(setq sp (vlax-3d-point (getpoint "\nPick point for table")))
(Setq vgms (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object))))
(setq numrows 5)
(setq numcolumns 5)
(setq rowheight 2.5)
(setq colwidth 60)
(setq objtable (vla-addtable vgms sp numrows numcolumns rowheight colwidth))
(vla-settext objtable 0 0 "DRAWING REGISTER")
(vla-settext objtable 1 0 "DRAWING NUMBER")
(vla-settext objtable 1 1 "DRAWING TITLE")
(vla-settext objtable 1 2 "C")
(vla-settext objtable 1 3 "D")
(vla-settext objtable 1 4 "E")
(vla-settext objtable 2 0 "1")
(vla-settext objtable 3 0 "2")
(vla-settext objtable 4 0 "3")
(command "_zoom" "e")
(princ)
)
(AHMaketable)


(princ "\n")
(setq n 2 txtht 45)
( AH:table_make 2 n txtht  400)
(setq objtable (vlax-ename->vla-object (entlast)))
would do the write line now do 

(vla-insertrows objtable  (setq n (1+ n)) (* txtht  2.0) 1)
(vla-settext objtable (1+ n) 0 val1)
(vla-settext objtable (1+ n) 1 val2)
(vla-settext objtable (1+ n) 1 val2)
(vla-setrowheight objtable (1+n)  (* txtht 2.0))
)

 

This is not true code but example call (ahmaketable) 1st then the insertrows. 

 

Oh yeah if table is huge make sure tableregenerate :vlax-false else will grind to a halt.

0 Likes
Message 24 of 28

rafael.bizarro
Participant
Participant

Could you help us get this Lisp right please?

0 Likes
Message 25 of 28

Sea-Haven
Mentor
Mentor

I am sure if you ask Kent nicely he will help you add the table part, then all the code is by 1 author and not bits pasted together. With conflicting variable names.

0 Likes
Message 26 of 28

rafael.bizarro
Participant
Participant

Kent, Could you add this routine to the LISP please?

0 Likes
Message 27 of 28

Kent1Cooper
Consultant
Consultant

Maybe later, after I have a chance to study it and understand what it is doing.  But I notice that the lower part calls for a function called  AH:table_make  which is not defined.  It can't be a typo that should be  AHMaketable , because the usage of  AH:table_make  supplies arguments which  AHMaketable  is not defined to take.

 

Kent Cooper, AIA
0 Likes
Message 28 of 28

Sea-Haven
Mentor
Mentor

Sorry cut bits out of a couple of programs, I have a default ah:maketable that I use and at some stage must have changed it.

 

It should be like

(defun ah:maketable ( numcolumns numrows colwidth rowheight  / sp curspace)

 

One buggy thing is that sometimes both Autocad and Bricscad lose objtable, so after making the initial table reset it again (setq objtable (vlax-ename->vla-object (entlast))) I do not know why it just stops working sometimes, the other is if doing a lot of insertrows, do (vla-put-regeneratetablesuppressed Objtable :vlax-true) and after populating the new rows do (vla-put-regeneratetablesuppressed Objtable :vlax-false) then it will draw the table. I have made tables with like 100 rows and it will just stop generating if you dont suppress the regen.

0 Likes