Jump to content

Need a lisp to prepare a table


aloy

Recommended Posts

  • Replies 30
  • Created
  • Last Reply

Top Posters In This Topic

  • aloy

    16

  • Tharwat

    12

  • Lee Mac

    1

  • MSasu

    1

Top Posters In This Topic

One more from my oldies:

(defun C:stbl(/ acsp adoc col header headers hgt line master row table tablelist x)
(vl-load-com) 
(or adoc
   (setq adoc (vla-get-activedocument
  (vlax-get-acad-object)))
   )
(or acsp
   (setq acsp (vla-get-block (vla-get-activelayout adoc)))
   )
(setq hgt (getvar "dimtxt"))
;; Here your put your master list, same as in your example

;; (setq master '(bla bla...)()()())

(setq tablelist  (mapcar '(lambda(x)(car (mapcar 'cons (list (car x))(cdr x)))) master))
(setq table (vlax-invoke acsp 'addtable (getpoint "\nTable location: ")(+ 2 (length tablelist))(length (car tablelist)) (* hgt 1.5) (* hgt 15)))
(vla-put-regeneratetablesuppressed table :vlax-true)
(vla-setcelltextheight table 0 0 5) 
 (vla-settext table 0 0 "Stations")
(setq headers (list "Distance" "X" "Y" "Z"))
(setq col 0)
(while (setq header (car headers))
  (vla-setcelltextheight table 1 col (* hgt 1.25))
 (vla-settext table 1 col header)
 (setq col ( 1+ col))
 (setq headers (cdr headers))
 )
(setq row 2)
(while (setq line (car  tablelist))
  (setq col  0)
 (foreach item line
      (vla-setcelltextheight table row col (* hgt 1.25))
 (vla-settext table row col (rtos item 2 3))
   (setq col (1+ col)))
 (setq row (1+ row))
 (setq tablelist (cdr tablelist)))
(vla-put-regeneratetablesuppressed table :vlax-false)
(princ)
)

 

~'J'~

Link to comment
Share on other sites

Hi Tharwat,

Yes, very nicely done. Do I have the permission to use it for my future projects?. Also how to remove the zeros being generated for Z coordinate by code that generate the list L?

Regards,

Aloy

Link to comment
Share on other sites

Hi Tharwat,

Yes, very nicely done.

 

Thank you Aloy . :)

 

Do I have the permission to use it for my future projects?. Also how to remove the zeros being generated for Z coordinate by code that generate the list L?

 

Sure you can use my code but without removing any part of it Aloy .

 

You can remove the Z coordinates by removing the codes related to it , but would you remove the Z column also or just the Z coordinates (contents) ?

 

Tharwat

Link to comment
Share on other sites

I am only preparing 2D drawings, therefore no need of z coordinates. The column No.4 is for remaks, which is meant to be for tangent to spiral, spiral to circle, circle to spiral and spiral to tangent. I must find a way to put them at chainages not divisible by 20 in that order when transition curves(spirals) are present in a highway. I will refine these later. Also I need to put the chainages in the standard format.

Regards,

Aloy

Link to comment
Share on other sites

Tharwat,

We need to be able to load the list seperately so that the draftperson can work independantly and list can change from section to section on the road. Also you need to put a variable for cell hight and text hight, just like the polyline code I have modified. I willtry the code you sent later.

With Best Regards,

Aloy

Link to comment
Share on other sites

Hi Tharwat,

Yes, it works; nothing in the 4th column. It works with the list L loaded seperately and as expected you name appears in the command window.

Regards

Aloy

Link to comment
Share on other sites

Tharwat,

I have managed to change the polyline code and yours with my Alisp, I will read up Vlisp and deal with similar things soon.

Regards,

Aloy

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...