Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/16/2023 in all areas

  1. Like Steven P says, your (spreadsheet?) probably needs more fields , for example I assume distances (...km) are probably different for each situation? Further more , each 'typical' (POP, GP) may need its own little symbol if each row can have a different setup. Can there be more than one row on each drawing? If so , create a little block called gridpoint or something on a non plotable layer so in your spreadsheet you can reference what row the symbols are coming. If all drawings are exactly the same as in your example , then its just one symbol with a couple of attributes and fill those with your data from your spreadsheet. Easiest way in my humble experience is to save your spreadsheet to a csv file , make sure first column is your point of reference (like drawing name or tag number whatever), read the complete list in one go into a lisp list and convert it to a assoc list like '((tag1 . (data...) ... (tagx . (data...)). From there you could do something like : for each row in list , erase everything in drawing & purge (to start with a blank drawing) , insert row-symbol(s) , fill attributes , saveas drawing , next row... etc. Hope I gave you some inspiration assuming your here to learn & try to write your own briliant app ofcource
    2 points
  2. If I can find some spare time (time is not my friend) will have a look at this but you're asking a lot bro...
    1 point
  3. I've made it more readable and improved coding, but haven't tested... Tell us how it passed test(s)... (defun c:kb_sc ( / *error* sc_ent sc_sc oldhpname oldhpscale ) (vl-load-com) ; enable VisualLisp extensions ; error handler (defun *error* ( m ) (if oldhpname (setvar (quote hpname) oldhpname) ) (if oldhpscale (setvar (quote hpscale) oldhpscale) ) (if m (prompt m) ) (princ) ) ; select area (command "_.PLINE") (while (< 0 (getvar (quote cmdactive))) (command "\\") ) (setq sc_ent (entlast)) (if (not (vlax-curve-isclosed sc_ent)) (vla-put-closed (vlax-ename->vla-object sc_ent) :vlax-true) ) ; scale (initget 7) (setq sc_sc (getdist "\nPick or specify scale : ")) ; hatching (setq oldhpname (getvar (quote hpname))) (setq oldhpscale (getvar (quote hpscale))) (setvar (quote hpname) "ANSI31") (setvar (quote hpscale) sc_sc) (command "_.HATCH" "_S" sc_ent "" "") (*error* nil) ) HTH. M.R.
    1 point
  4. Thank you so much for helping me. I did it, and it works just fine. I even changed "m" to "m^2", but the last thing I would like to know is how to change size of the table, because it so big in the drawing. I changed all the numbers but its only affecting text not the table.
    1 point
  5. It works perfectly!!! @Emmanuel Delay, thank you so much, I really appreciate the time you took to help me! Really nice of you, mate!
    1 point
  6. See if this works. I took out all visual LISP (no vl-, no vla- ...), just left vanilla LISP ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Get Attribute Values - Lee Mac ;; Returns an association list of attributes present in the supplied block. ;; blk - [ent] Block (Insert) Entity Name ;; Returns: [lst] Association list of ((<tag> . <value>) ... ) ;; http://www.lee-mac.com/attributefunctions.html#algetattributevaluerc (defun LM:getattributevalues ( blk / enx ) (if (and (setq blk (entnext blk)) (= "ATTRIB" (cdr (assoc 0 (setq enx (entget blk)))))) (cons (cons (cdr (assoc 2 enx)) (cdr (assoc 1 (reverse enx))) ) (LM:getattributevalues blk) ) ) ) ;; get a specific value; given the result of LM:getattributevalues (defun getAttributeValue ( attributevalues tag / res att) (foreach att attributevalues (if (= tag (car att)) (setq res (cdr att)) ) ) res ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun export2file (data / fname file) (setq fname "D:/extbl.txt") (setq file (open fname "w")) ;; whrite all lines (foreach line data (write-line line file) ) (close file) (startapp "notepad.exe" fname) ) ;_ end of defun (defun c:extbl ( / ss i en obj data ip line_str attributes material year status ) ;; Select the blocks (setq ss (ssget "X" '((0 . "INSERT") (2 . "TEST"); object Name ) ) ) (setq data (list)) ;; list of lines to be exported (setq i 0) (repeat (sslength ss) (setq en (ssname ss i) obj (vlax-ename->vla-object en) ) ;; read coordinates (setq ip (cdr (assoc 10 (entget en)))) ;; read attributes (setq attributes (LM:getattributevalues en)) (setq material (getAttributeValue attributes "MATERIAL")) (setq year (getAttributeValue attributes "YEAR")) (setq status (getAttributeValue attributes "STATUS")) (princ "\n") ;; assemble the line (setq line_str (strcat material "," (rtos (nth 0 ip) 2 10) "," (rtos (nth 1 ip) 2 10) "," year "," status )) (setq data (append data (list line_str ))) (setq i (+ i 1)) ) ;; export all (export2file data) (princ) )
    1 point
  7. I think you'll need more data in your spreadsheet, for example if the structure is connected to a T, or a straight connection
    1 point
  8. Have a go, and see if you can get it to work - it is all there, but we can help you along the way and is a great way to learn
    1 point
×
×
  • Create New...