Jump to content

i need lisp pls help me cordinate???


afrazawan

Recommended Posts

asos2000 & Tiger,

 

for both of u thanks alot,

Again i am faceing problem?

 

I use this lisp in my co-ordinate drawing, but its not comeing actule co-ordinate, I check with "UCS" allso thats in correct way, my drawing units are milimeters, table is show {xxxxxxx'-xxx"} like that,

So I think it besaue of unit problem,

 

PLEASE HOW TO SOLVE THE ABOVE MATTER

 

This lisp file is very good

Link to comment
Share on other sites

  • Replies 22
  • Created
  • Last Reply

Top Posters In This Topic

  • Lee Mac

    5

  • afrazawan

    4

  • stevesfr

    3

  • ruksi

    3

Top Posters In This Topic

Posted Images

  • 1 year later...
I think that he wants the lisp to be at this sequance

 

- Pick a point

- Insert a point and a sequencial number

- at end create a table has the point number and N and E for

 

So See this

;; local defun
(defun make-tablestyle ( name desc txtstyle h1 h2 h3 / tblstyle adoc)
 (or (vl-load-com))
 (setq 
   tblstyle (vla-addobject 
     (vla-item (vla-get-dictionaries 
             (setq adoc (vla-get-activedocument (vlax-get-acad-object))) 
             ) 
          "Acad_Tablestyle" 
          ) 
     name 
     "AcDbTableStyle" 
     ) 
   )
 (setq acmCol (vla-getinterfaceobject
       (vlax-get-acad-object)
       (strcat "AutoCAD.AcCmColor."
        (substr (getvar "ACADVER") 1 2))))  
 (vla-put-name tblstyle name)
 
 (vla-put-headersuppressed tblstyle :vlax-false) 
 (vla-put-titlesuppressed tblstyle :vlax-false)
 (vla-put-description tblstyle desc) 
 (vla-put-flowdirection tblstyle 0)
 (vla-put-bitflags tblstyle 1)
 (vla-put-horzcellmargin tblstyle (/ h3 5))  
 (vla-put-vertcellmargin tblstyle (/ h3 5))
 (vla-settextstyle tblstyle 7 txtstyle)
 (vla-settextheight tblstyle 1 h3)  
 (vla-settextheight tblstyle 4 h2) 
 (vla-settextheight tblstyle 2 h1) 
 (vla-setrgb acmCol 204 102 0)
 (vla-setgridcolor tblstyle 63 7 acmCol)
 
 (vla-setgridvisibility tblstyle 63 7 :vlax-true) 
 (vla-setgridlineweight  tblstyle 18 7 aclnwt009) 
 (vla-setgridlineweight tblstyle 45 7 aclnwt050) 
 (vlax-release-object acmCol)
 )
;; local defun
(defun draw_table (ins_point title     header_list
                               table_data
                               /         acmcol
                               acsp      adoc
                               axss      cnt
                               col       columns
                               dht       lst_count
                               objtable  row
                               rows
                              )
 (if (< (atof (getvar "ACADVER")) 16.0)
 (alert "This routine will work\nfor versions A2005 and higher")
 (progn
 (alert "\tBe patience\n\tWorks slowly")
 (or (vl-load-com)) 
 (or adoc
   (setq adoc (vla-get-activedocument
 (vlax-get-acad-object))))
 (or acsp (setq acsp (if (= (getvar "TILEMODE") 0)
 (vla-get-paperspace
 adoc)
 (vla-get-modelspace
 adoc))
 )
 )
 (make-tablestyle "Point Data" "Symbol table" "Standard" 10.0 10.0 12.0)
 (setq acmCol (vla-getinterfaceobject
       (vlax-get-acad-object)
       (strcat "AutoCAD.AcCmColor."
        (substr (getvar "ACADVER") 1 2))))
 (setq dht (getvar "dimtxt")); text height, change by suit
 (setq lst_count nil)
(setq columns  (length (car table_data)) 
rows  (length table_data) 
 )
(setq objtable (vlax-invoke
  acsp
  'Addtable
  ins_point
  (+ 2 rows)
  columns
  ;; rows height (change by suit):
  (* dht 1.667);28
  ;; columns width (change by suit):
  (* dht 8.333);50
       )
 )
 (vla-put-regeneratetablesuppressed objtable :vlax-true)
 (vla-put-layer objtable "0")
 (vla-put-titlesuppressed objtable :vlax-false)
 (vla-put-headersuppressed objtable :vlax-false)
 (vla-put-horzcellmargin objtable (* dht 0.5))
 (vla-put-vertcellmargin objtable (* dht 0.5))
 
 (vla-settextstyle objtable 2 "Standard")
 (vla-settextstyle objtable 4 "Standard")
 (vla-settextstyle objtable 1 "Standard")
 
 (vla-setrowheight objtable 2 (* dht 1.5))
 (vla-setrowheight objtable 4 (* dht 1.25))
 (vla-setrowheight objtable 1 (* dht 1.25))
 
 (vla-settextheight objtable 2 (* dht 1.25))
 (vla-settextheight objtable 4 dht)
 (vla-settextheight objtable 1 dht)
 
 (vla-put-colorindex acmcol 256)
 (vla-put-truecolor objtable acmcol)
 
 (vla-setcolumnwidth objtable 0 (* dht 10))
 (vla-setcolumnwidth objtable 1 (* dht 15))
 (vla-setcolumnwidth objtable 2 (* dht 15))
 (vla-setcolumnwidth objtable 3 (* dht 15))
 
 (vla-put-colorindex acmcol 2)
 (vla-settext objtable 0 0 title)
 (vla-setcelltextheight objtable 0 0 (* dht 1.5))
 (vla-setcellcontentcolor objtable 0 0 acmcol)
 (vla-put-colorindex acmcol 102)
 (setq col 0
row 1
 )
 (foreach a header_list
   (vla-settext objtable row col a)
   (vla-setcelltextheight objtable row col (* dht 1.25))
   (vla-setcellcontentcolor objtable row col acmcol)
   (setq col (1+ col))
 )
(vla-put-colorindex acmcol 40)  
(setq  row 2 col 0)
 (setq cnt 1 row 2)
 (foreach i table_data
 (setq col 0)
 (foreach a i
   
   (if (= col 0)
    (progn
    (vla-settext objtable row col a)    
   (vla-setcellalignment objtable row col acMiddleLeft))
    (progn
      (vla-settext objtable row col (rtos a 3 2))  
   (vla-setcellalignment objtable row col acMiddleCenter))
    )
   (vla-setcellcontentcolor objtable row col acmcol)
   (setq col (1+ col)))
   (setq row (1+ row))
   )
 (vla-put-regeneratetablesuppressed objtable :vlax-false)
 (vl-catch-all-apply
   (function
     (lambda ()
(progn
  (vla-clear axss)
  (vla-delete axss)
  (mapcar 'vlax-release-object (list axss objtable))
  )
)
     )
   )
 (vla-regen adoc acactiveviewport)
 (alert "Done")
 )
   )
 (princ)
)
;; local defun
(defun draw_textfromlist (data_list txt_height / )
   (or (vl-load-com))
   (or adoc
   (setq adoc (vla-get-activedocument
 (vlax-get-acad-object))))
 (or acsp (setq acsp (if (= (getvar "TILEMODE") 0)
 (vla-get-paperspace
 adoc)
 (vla-get-modelspace
 adoc))
 )
 )
   (mapcar (function (lambda(x)
                            (vlax-invoke acsp 'AddText
                                           (car x)
                                           (list (cadr x)(+ (caddr x)(* txt_height 0.785))(last x))
                                           txt_height)))
            data_list
            )
   (princ)
   )
;; main part
(defun C:PNT (/ ans fd fname lbl loop num pfx pt pts)
(initget "Y N") 
(setq ans (getkword "\nDo you want to add prefix? (Y/N) <Y> : ")) 
(if (not ans)(setq ans "Y"))
 (if (eq "Y" ans)
     (setq pfx (getstring T "\nEnter the prefix to add: ")))
 (setq num (getint "\n Enter the initial number <1> : "))
   (if (not num)(setq num 1))
   (setq pt (getpoint "\nDigitize the first point :")
  lbl (if pfx (strcat pfx (itoa num))(itoa num))
pts (cons (cons lbl pt) pts))
 (setq num (1+ num))
   (while 
   (setq pt (getpoint "\nDigitize the next point [hit Enter to exit] :" pt))
   (if (null pt)(setq loop nil))
   (setq lbl (if pfx (strcat pfx (itoa num))(itoa num)))
   (setq  pts (cons (cons lbl pt) pts))
   (setq num (1+ num))
   )
   (setq pts (reverse pts))
   (draw_textfromlist pts  (getvar "dimtxt"));<-- text height, change by suit
 (initget "E A") 
 (setq ans (getkword "\nDo you want to export point to Excel Or draw Acad table? (E/A) <E> : ")) 
 (if (not ans)(setq ans "E"))
 (if (eq "E" ans)
     (progn
 (setq fname (getfiled "* Set Name Of New Excel File *" "" "xls" 1))
 (setq fd (open fname "w"))
 (princ "Point label\tX coord.\tY coord.\tZ coord.\n" fd)
 (foreach i pts
   (princ (strcat (car i) "\t"
    (rtos (cadr i) 3 2) "\t"
    (rtos (caddr i) 3 2) "\t"
    (rtos (last i) 3 2) "\n")
   fd)
)
 (close fd)
     )
     (progn
         (setq ipt (getpoint "\nPick insertion point of table: "))
         (draw_table ipt "Title goes here" '("Point No." "X coord." "Y coord" "Z coord.") pts)
         )
     )
   (princ)
 )
(princ "\n\t\t***\tType PNT to export points to Excel or to Acad table\t***")
(princ)

 

This works fine, except I need a clue on how to get table to report as pt#, North, East, Elev. instead of Pt#, East, North, Elev.

I was able to get the data to xls file to be reversed, but not the table. Need your suggestion on what lines to revise. TIA

Steve

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