Jump to content

generate X & Y coordinates into table


The Courage Dog

Recommended Posts

VVA I can't seem to omit entirely "Gravity Center" row ?

give me a clue what to modify?

Steve

Comment out (or delete) in red to # 96

Link to comment
Share on other sites

help fix lisp (tabcord.lsp) as follows:

- Add height (Z)

- Size when running next to

- Building layer: the point; size and number

as illustrations

would like to thank! Drawing.dwg

Link to comment
Share on other sites

  • 4 months later...

hi to all please this lisp file is so good thank for that ....

when problam coming with him some time center co-ordinte its not giving woring

can you give me help this some time is ok

Link to comment
Share on other sites

  • 2 months later...

Hello Guys,

 

is it possible to make something like, for example

 

a command that will let you to number your objects ( while it will ask you for prefix and suffix) text size, also the location of text(shown on photo below) it can be TEXT(MTEXT) or MultiLeader if possible, after you enter all data, it will regenerate a table which will include the names of the objects, coordinate X and Y. thanks in advice

 

text.jpg

Link to comment
Share on other sites

  • 2 months later...

Hi there Fixo,

 

This might sound like a silly question. I would love to use this LISP as well. I just apploaded it, what is the command I type in to make it work?

Link to comment
Share on other sites

Hi there Fixo,

 

This might sound like a silly question. I would love to use this LISP as well. I just apploaded it, what is the command I type in to make it work?

 

Try TABCORD

Link to comment
Share on other sites

  • 1 year later...
Give that a try

 

~'J'~

 

Hi,

Does anyone know how to modify CoordsToTable.LSP‎ by Fixo (reply #2), to create a table by selecting points and not polylines - without the column radius?

 

Thanks in advance.

Link to comment
Share on other sites

Hi

Try this code, mostly borrowed from Peter Jamtgaard:

;; nice code example by Peter Jamtgaard (variables were shortened)
;; [ sorry Peter ]
(defun lstToTable (insPt ; List Insertion point of Table
title ; String Table Title
cmLst ; List of sublists of Values in Rows
/
accol ;AutoCAD.AcCmColor object
col ; Integer Column Item
rows ; Integer Number of Rows
cols ; Integer Number of Columns
row ; Integer Row Item
sbLst ; List of Values in a Row
atable ; Table Object 
strg ; String Item in List
)
(if (not insPt)
(setq insPt (getpoint "\nSelect Insertion Point: ")))
(setq rows (1+ (length cmLst))
cols (apply 'max (mapcar 'length cmLst))
atable (vla_addTable insPt rows cols)
)
; to prevent display table changes at runtime:
(vla-put-regeneratetablesuppressed atable :vlax-true);supres opening and closing table-block object at each writting to table
 (setq accol (vla-get-truecolor atable))
 (vla-setrgb accol 16 37 66)
 (vla-put-truecolor atable accol)

 
;************************************************************************************
; Populate Title and set title
(vla-settext atable 0 0 title)
 (vla-setrgb accol 255 161 66)
 (vla-setcellcontentcolor atable 0 0 accol)
 ;(vla-setrgb accol 0 64 255)
  (vla-setrgb accol 20 27 105)
(vla-SetCellBackgroundColor atable 0 0 accol)

 (vla-setrgb accol 82 0 0)
;************************************************************************************
; Populate Column Headers and Data Rows
(setq row 1 
col 0
)
(foreach sbLst cmLst
(foreach strg sbLst 
(vla-settext atable row col strg)
  (vla-setcellalignment atable row col acMiddleCenter)
  (vla-setrgb accol 82 0 0)
  (vla-setcellcontentcolor atable row col accol)
  
  (if (> col 0)(progn
 (vla-setcelldatatype atable row col acdouble acUnitDistance)
 (vla-setcellformat atable row col "%lu2%pr2")))
   (vla-setrgb accol  255 245 235)
  (vla-SetCellBackgroundColor atable row col accol)
  (setq col (1+ col))
)
(setq col 0 
row (1+ row)))
 (vla-insertrows atable 1 (* txtsize 1.5) 1)
 (setq col 0 row 1)
 (foreach strg (list "PT." "X" "Y")
    (vla-settext atable row col strg)
  (vla-setcellalignment atable row col acMiddleCenter)
  (vla-setrgb accol 82 0 0)
  (vla-setcellcontentcolor atable row col accol)
(vla-setrgb accol 249 198 182)
   (vla-SetCellBackgroundColor atable row col accol)
   (setq col (1+ col)))
 (vla-setcolumnwidth atable 0 (* (getvar 'textsize) )
 (vla-setrowheight atable 1 (* (getvar 'textsize) 1.5))
;(vla-recomputetableblock atable :vlax-true) ;on the end display table object changes: Every instance of vla-settext
; opens table-block object, writes and closes them.Works pretty slow!
(vla-put-regeneratetablesuppressed atable :vlax-false)
(vlax-release-object atable) ;release memory used to create this object
 (vlax-release-object accol)
)
; The Create Table Function Accepts 3 Arguments including the 
; Insertion point of the table, the Number of Rows and Number of Columns.

(defun vla_addTable (insPt ; Insertion Point of Table 
                        rows        ; Integer Number of Rows in Table
                        cols     ; Integer Number of Columns in Table
                        / 
                        atable          ; Table Object
                       )
(setq txtsize (getvar 'textsize);|(variant-value (vla-getvariable 
                                  (vla-get-activedocument 
                                   (vlax-get-acad-object)) 
                                  "textsize"))|;;commented
      atable     (vla-addtable (vla-get-block 
                                  (vla-get-activelayout
                                   (vla-get-activedocument 
                                    (vlax-get-acad-object))))
                                      (vlax-3d-point insPt)
                                 rows
                                 cols
                                 (* txtsize 1.25)
                                 (* txtsize 15)))
atable
)
;;       ;;
;; = return column name by given number = ;;
;;       ;;
(defun columnchar  (col / fst snd)
;; author VK (Vladimir Kleshev)
 (cond ((or (minusp col) (> col 256))
 nil
 )
((<= col 26)
 (chr (+ col 64)))
(T
 (setq fst (rem col 26)
       snd (fix (/ col 26)))
 (if (zerop fst)
   (progn
     (setq fst 26
    snd (1- snd)))
   )
 (strcat (chr (+ snd 64)) (chr (+ fst 64)))
 )
)
 )
;; usage, e.g.: 
(defun C:garb(/ i p pt pts)
(setvar'snapmode 0)
(setvar 'osmode 584)
 (setq i 0)
 (while (setq p (getpoint"\nPick point location:"))
   (setq pts (cons (list  (columnchar(setq i (1+ i))) (car p)(cadr p)) pts))
   )
 (setq pts (reverse pts))
 (setvar 'osmode 0)
 (setq pt (getpoint"\nPick table insertion point:"))
 (lstToTable pt "COORDINATES" pts)
 (princ)
 )

Link to comment
Share on other sites

Hi

Try this code, mostly borrowed from Peter Jamtgaard:

 

Fixo,

Many thanks for your reply and help.

There is the possibility to follow this sequence of selection?

Pick point location: 
Select title of point (a string):
Pick point location: 
Select title of point (a string):
...
Pick table insertion point:

Edited by antistar
Link to comment
Share on other sites

  • 2 months later...

Hello lispers!

 

I have been trying to make use of Asmi´s lisp TABCORD, and its great! Nonetheless, in some cases when I create a polyline with arcs, the center xy coordinates for the arc sometimes output a wrong value. The xy coordinates it reports, correspond to a point directly opposite of the arc center (only in certain arcs). I´ve tried reversing the polyline direction and no luck. I´m guessing it's something associated with the polyline bulge sign assignment.

 

Just wanted to check with you all if there is a variable that I need to modify in my AutoCAD settings of if it is an error intrinsic to the programmed lisp. If it is an error.... ideas of how to fix it would be appreciated. =)

 

Thank you and have a good afternoon!

Link to comment
Share on other sites

  • 2 months later...

I copy the following response I had by Lee Mac via email which fixes the problem mentioned in my previous post:

 

"Regarding TABCORD – you are not at fault, the program does indeed calculate the center coordinates incorrectly.

To fix the problem, replace lines 198-200 (inclusive):

 

       pCen(trans
                        (polar aCen(-(if(minusp(last vert)) pi(* 2 pi))
                          (atan(/(car fDr)(cadr fDr))))cRad)0 1)

 

With:

 

    pCen (polar pt1 (+ (angle pt1 pt2) (- (/ pi 2) 
(* 2 (atan (last vert))))) (/ (* (distance pt1 pt2) 
(1+ (* (last vert) (last vert)))) 4 (last vert)))

 

That should fix it!

 

Cheers,

 

Lee"

 

 

Thank you very much for the solution Mr. Lee Mac!

Link to comment
Share on other sites

  • 6 years later...

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...