乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 12|回复: 4

[编程交流] 与表格的坐标

[复制链接]

2

主题

9

帖子

7

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-5 18:34:08 | 显示全部楼层 |阅读模式
大家好!
不久前,我发现lisp可以根据放置在图形中的坐标点创建坐标表。
我发布的代码在自定义点处创建块,递增编号,并根据放置在图形中的坐标点(块)创建坐标表。我很满意它的工作方式,但我希望有人帮助编辑代码,以具有额外的能力,自动放置(创建)在选定的多段线的真实块。
我没有lisp编程经验!
 
提前感谢!
 
  1.   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;; Title: Cordinates with Table          ;;
  3. ;; Purpose: Numbering & create table     ;;
  4. ;; Written: Bijoy Manoharan              ;;
  5. ;; Command: CN, CSN, RES, CRT            ;;
  6. ;; Date   : Sep-2011                     ;;
  7. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  8. ;; sub function error
  9. (defun trap1 (errmsg)
  10.           (setvar "attdia" ad)
  11.    (setvar "attreq" aq)
  12.           (setq *error* temperr)
  13.           (prompt "\n Enter Command CSN for Point Sub Numbering or CRT for Table")
  14. (princ)
  15. ) ;defun
  16. (defun trap2 (errmsg)
  17.           (setvar "attdia" ad)
  18.    (setvar "attreq" aq)
  19.           (setq *error* temperr)
  20.           (prompt "\n Enter Command CN to Continue Point Numbering or CRT for Table")
  21. (princ)
  22. ) ;defun
  23. (defun trap3 (errmsg)
  24.           (setq *error* temperr)
  25.           (prompt "\nCoordinate Table Command Cancelled")
  26. (princ)
  27. ) ;defun
  28. ;;-----------------------------------sub function to create block
  29. ;;;--- create block function start -----
  30. (defun crb ( )
  31.    
  32.    (if (not (tblsearch "BLOCK" "CRBLK"))
  33.        (progn
  34.            (if (not (tblsearch "STYLE" "Gen-Text"))
  35.                (entmake
  36.                    (list
  37.                        (cons 0 "STYLE")
  38.                        (cons 100 "AcDbSymbolTableRecord")
  39.                        (cons 100 "AcDbTextStyleTableRecord")
  40.                        (cons 2 "Gen-Text")
  41.                        (cons 70 0)
  42.                        (cons 40 2.5)
  43.                        (cons 3 "Arial.ttf")
  44.                    )
  45.                )
  46.            )
  47.            (entmake
  48.                (list
  49.                    (cons 0 "BLOCK")
  50.                    (cons 8 "0")
  51.                    (cons 370 0)
  52.                    (cons 2 "CRBLK")
  53.                    (cons 70 2)
  54.                    (cons 4 "Block to Place Coordinate Points")
  55.                    (list 10 0.0 0.0 0.0)
  56.                )
  57.            )
  58.            (entmake
  59.                (list
  60.                    (cons 0 "CIRCLE")
  61.                    (cons 8 "0")
  62.                    (cons 370 0)
  63.                    (list 10 0.0 0.0 0.0)
  64.                    (cons 40 1.25)
  65.                )
  66.            )
  67.            (entmake
  68.                (list
  69.                    (cons 0 "ATTDEF")
  70.                    (cons 8 "0")
  71.                    (cons 370 0)
  72.                    (cons 7 "Gen-Text")
  73.                    (list 10 3.0 2.5 0.0)
  74.                    (list 11 3.0 2.5 0.0)
  75.                    (cons 40 2.5)
  76.                    (cons 1 "00")
  77.                    (cons 3 "Coordinate Point")
  78.                    (cons 2 "00")
  79.                    (cons 70 0)
  80.                    (cons 72 0)
  81.                    (cons 74 2)
  82.                )
  83.            )
  84.            (entmake
  85.                (list
  86.                    (cons 0 "ENDBLK")
  87.                    (cons 8 "0")
  88.                )
  89.            )
  90.            
  91.   ;;;--- To set block units in metre 70-6
  92.               
  93.                (
  94.                    (lambda ( lst )
  95.                        (regapp "ACAD")
  96.                        (entmod
  97.                            (append (subst (cons 70 6) (assoc 70 lst) lst)
  98.                                (list
  99.                                   (list -3
  100.                                       (list "ACAD"
  101.                                           (cons 1000 "DesignCenter Data")
  102.                                           (cons 1002 "{")
  103.                                           (cons 1070 1)
  104.                                           (cons 1070 1)
  105.                                           (cons 1002 "}")
  106.                                       )
  107.                                   )
  108.                               )
  109.                            )
  110.                        )
  111.                    )
  112.                    (entget (cdr (assoc 330 (entget (tblobjname "BLOCK" "CRBLK")))))
  113.                )
  114.             
  115. ;;;--- To make block annotative
  116.          
  117.           (
  118.                (lambda ( lst )
  119.                    (regapp "ACAD")
  120.                    (regapp "AcadAnnotative")
  121.                    (entmod
  122.                        (append (subst (cons 70 1) (assoc 70 lst) lst)
  123.                            (list
  124.                               (list -3
  125.                                   (list "ACAD"
  126.                                       (cons 1000 "DesignCenter Data")
  127.                                       (cons 1002 "{")
  128.                                       (cons 1070 1)
  129.                                       (cons 1070 1)
  130.                                       (cons 1002 "}")
  131.                                   )
  132.                                   (list "AcadAnnotative"
  133.                                       (cons 1000 "AnnotativeData")
  134.                                       (cons 1002 "{")
  135.                                       (cons 1070 1)
  136.                                       (cons 1070 1)
  137.                                       (cons 1002 "}")
  138.                                   )
  139.                               )
  140.                           )
  141.                        )
  142.                    )
  143.                )
  144.                (entget (cdr (assoc 330 (entget (tblobjname "BLOCK" "CRBLK")))))
  145.            )
  146.        )
  147.    )
  148.   
  149. ;;;--- to disable allow explod-----
  150.   
  151.          (vl-load-com)
  152.          (setq BLOCKS
  153.          (vla-get-Blocks
  154.           (vla-get-activedocument
  155.            (vlax-get-acad-object)
  156.           )
  157.          )
  158.         BLK (vla-Item BLOCKS "CRBLK")
  159.       )
  160.      (vla-put-explodable (vla-Item BLOCKS "CRBLK") :vlax-false)
  161.   
  162. ;;;--- end to disable allow explod-----
  163.   
  164.   (princ)
  165. )
  166. ;;;--- create function block end -----
  167. ;;------------------------main functions-------
  168. (defun c:CN(/ num num1 pt ptlist name mh-text ad aq)
  169.           (command "cmdecho"0)
  170.           (setq clay (getvar "clayer"))
  171.           (setq ad (getvar "attdia"))
  172.           (setq aq (getvar "attreq"))
  173.           (setq temperr *error*)
  174.           (setq *error* trap1)
  175.           (setvar "attdia" 0)
  176.           (setvar "attreq" 1)
  177.   
  178.                   
  179.      ;;; input text name  
  180.       
  181.           (if (not namef) (setq namef ""))
  182.           (setq name (getstring (strcat "\nEnter prefix text <" namef ">: ")))
  183.           (if (= name "") (setq name namef) (setq namef name))      
  184.   
  185.    ;;; input number
  186.       
  187.           (if (not nf-ns) (setq nf-ns 1))    ; default number
  188.           (setq NUM (getreal (strcat "\nEnter point number : <" (rtos nf-ns 2 0) ">: ")))  
  189.           (if (not num) (setq num nf-ns) (setq nf-ns num))
  190.             
  191.   ; to create new layer
  192.           (if (not (tblsearch "layer" "Coordinate Points")) (command "-LAYER" "N" "Coordinate Points" "C" "7" "Coordinate Points" "LT" "Continuous" "Coordinate Points""LW" "0.00" "Coordinate Points" ""))      
  193.                   
  194.   ;;; create mh numbers
  195.   
  196.    (setq ptlist nil) ; for while command
  197.    
  198.       (while     
  199.         (progn
  200.    
  201.           (setq PT (getpoint "\nPick point location: ")) ;;; input text location           
  202.          
  203.           (if (< num 10.0) (setq num1 (strcat "0" (rtos num 2 0))))
  204.           (if (>= num 10.0) (setq num1 (rtos NUM 2 0)))
  205.          
  206.          (crb) ;create block
  207.          
  208.          (setq mh-text (strcat name num1)) ; combine text into one variable           
  209.   
  210.        (if (not (= pt nil))  (command "CLAYER" "Coordinate Points")) ;if
  211.        (if (not (= pt nil))  (command "-insert" "CRBLK" pt "1" "1" "0" mh-text)) ;if
  212.        (if (not (= pt nil))  (setvar "clayer" clay)) ;if
  213.        (setq by (strcat (Chr 66)(Chr 73)(Chr 74)(Chr 79)(Chr 89)(Chr 183)(Chr 86)(Chr 183)(Chr 77)))
  214.        (if (not (= pt nil))  (setq num (+ num 1))) ; for increment
  215.        (if (not (= pt nil))  (setq suf (- num 1)))
  216.        (if (not (= pt nil))  (setq nf-ns num))
  217.       
  218.           (setq ptlist (append ptlist (list pt))) ; to stop while command
  219.          
  220.          ) ;progn  
  221.        ) ;while
  222.       
  223. (setvar "clayer" clay)        
  224. (princ)
  225. ) ;defun
  226. (defun c:CSN(/ numf snum sf-ss mh-text pt ptlist ptx pty name ad aq)
  227.           (command "cmdecho"0)
  228.           (setq clay (getvar "clayer"))
  229.           (setq ad (getvar "attdia"))
  230.           (setq aq (getvar "attreq"))
  231.           (setq temperr *error*)
  232.           (setq *error* trap2)
  233.           (setvar "attdia" 0)
  234.           (setvar "attreq" 1)
  235.          
  236.   ;;; input  name  
  237.       
  238.           (if (not namef) (setq namef ""))
  239.           (setq name (getstring (strcat "\nEnter prefix text <" namef ">: ")))
  240.           (if (= name "") (setq name namef) (setq namef name))
  241.   ;;; input  number
  242.       
  243.           (if (not suf) (setq suf 1))    ; default number
  244.           (setq NUMF (getreal (strcat "\nEnter point number : <" (rtos suf 2 0) ">: ")))  
  245.            (if (not numf) (setq numf suf) (setq suf numf))
  246.   ;;; input  sub number
  247.       
  248.           (if (not sf-ss) (setq sf-ss 1))    ; default number
  249.           (setq SNUM (getreal (strcat "\nEnter point subnumber : <" (rtos sf-ss 2 0) ">: ")))  
  250.            (if (not snum) (setq snum sf-ss) (setq sf-ss snum))
  251.   ;;; set arial.ttf to default linestyle
  252.           (if (not (tblsearch "style" "Gen-Text")) (command "-style" "Gen-Text" "Arial.ttf" 2.5 "1" 0 "n" "n"))
  253.          
  254.   ; to create new layer
  255.           (if (not (tblsearch "layer" "Coordinate Points"))
  256.                    (command "-LAYER" "N" "Coordinate Points" "C" "7" "Coordinate Points" "LT" "Continuous" "Coordinate Points""LW" "0.00" "Coordinate Points" ""))      
  257.                   
  258.                   
  259.   ;;; create NO numbers
  260.   
  261.    (setq ptlist nil) ; for while command
  262.    
  263.       (while     
  264.         (progn
  265.    
  266.           (setq PT (getpoint "\nPick Point location: ")) ;;; input text location
  267.          
  268.           (if (< numf 10.0) (setq numf1 (strcat "0" (rtos numf 2 0))))
  269.           (if (>= numf 10.0) (setq numf1 (rtos numf 2 0)))
  270.           (if (< snum 10.0) (setq snum1 (strcat "0" (rtos snum 2 0))))
  271.           (if (>= snum 10.0) (setq snum1 (rtos snum 2 0)))
  272.           (crb) ;create block
  273.          
  274.           (setq mh-text (strcat name numf1 "-" snum1)) ; combine text into one variable
  275.          
  276.           (if (not (= pt nil))(command "CLAYER" "Coordinate Points"))
  277.           (if (not (= pt nil))(command "-insert" "CRBLK" pt "1" "1" "0" mh-text))
  278.           (if (not (= pt nil))(setvar "clayer" clay))
  279.           (if (not (= pt nil))(setq snum (+ snum 1))) ; for increment
  280.           (if (not (= pt nil))(setq nf-ns (+ numf 1)))
  281.          
  282.           (setq ptlist (append ptlist (list pt))) ; to stop while command
  283.            
  284.          ) ;progn  
  285.        ) ;while      
  286.       
  287. (princ)
  288. ) ;defun
  289. (defun c:RES ()
  290.   (setq namef "")
  291.   (prompt "\nPrefix Text Variable Reseted")
  292.   
  293. (princ)
  294. ) ;defun
  295. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  296. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  297. ;;---------- sub function for Table----------
  298. (defun CRTable ()        
  299.       
  300. (setq LEN (length CORDS))
  301. (setq CORDS (acad_strlsort CORDS))                        ;;;sorts list into order
  302. (setq CNT 0)
  303. (if (= (getvar "tilemode") 1) (setvar "tilemode" 0))
  304. (command "pspace")
  305. (setq SP (getpoint "\nPick start point for table"))
  306.        (setq ht 2.5) ;; text hieght
  307.       
  308.        (command "-style" "Gen-Text" "Arial.ttf" 2.5 "1" 0 "n" "n")
  309.        (if (not (tblsearch "layer" "Coordinate Table"))
  310.        (command "-LAYER" "N" "Coordinate Table" "C" "7" "Coordinate Table" "LT" "Continuous" "Coordinate Table""LW" "0.00" "Coordinate Table" ""))
  311.        
  312. (if (/= SP nil)                                                ;;;checks for null input
  313.   (progn
  314.     (setq TXTX (car SP))                                ;;;gets x coord of text start point
  315.     (setq fx txtx)                                      ;;; set first x value
  316.    
  317.     (setq TXTY (cadr SP))                                ;;;gets y coord
  318.     (setq fy TXTY)
  319.    
  320.     (setq encw 25.00)  ; easting & northing Column width
  321.            (setq nocw 20.00)  ; number Column width            
  322.            
  323.            (setq ten (/ encw 2))
  324.            (setq tno (+ (/ nocw 2) ten))
  325.   
  326.     ;; place easting & northing text
  327.     (entmake
  328.       (list
  329.         (cons 0 "text")
  330.         (cons 1 "COORDINATES")
  331.         (cons 7 "Gen-Text")
  332.         (cons 8 "Coordinate Table")
  333.         (cons 10 (list (+ TXTX 2.5) (+ TXTY (/ ht 2) (* ht 2))))
  334.         (cons 11 (list (+ TXTX 2.5) (+ TXTY (/ ht 2) (* ht 2))))
  335.         (cons 40 3.0)
  336.         (cons 50 0.0)
  337.         (cons 72 4)
  338.       )
  339.     )
  340.    
  341.     (entmake
  342.       (list
  343.         (cons 0 "text")
  344.         (cons 1 "POINTS")
  345.         (cons 7 "Gen-Text")
  346.         (cons 8 "Coordinate Table")
  347.         (cons 10 (list (- TXTX tno) TXTY))
  348.         (cons 11 (list (- TXTX tno) TXTY))
  349.         (cons 40 ht)
  350.         (cons 50 0.0)
  351.         (cons 72 4)
  352.       )
  353.     )
  354.         
  355.     (entmake
  356.       (list
  357.         (cons 0 "text")
  358.         (cons 1 "EASTING")
  359.         (cons 7 "Gen-Text")
  360.         (cons 8 "Coordinate Table")
  361.         (cons 10 (list TXTX TXTY))
  362.         (cons 11 (list TXTX TXTY))
  363.         (cons 40 ht)
  364.         (cons 50 0.0)
  365.         (cons 72 4)
  366.       )
  367.     )  
  368.         
  369.     (entmake
  370.       (list
  371.         (cons 0 "text")
  372.         (cons 1 "NORTHING")
  373.         (cons 7 "Gen-Text")
  374.         (cons 8 "Coordinate Table")
  375.         (cons 10 (list (+ TXTX encw) TXTY))
  376.         (cons 11 (list (+ TXTX encw) TXTY))
  377.         (cons 40 ht)
  378.         (cons 50 0.0)
  379.         (cons 72 4)
  380.       )
  381.     )      
  382.    
  383.     ;; place easting & northing horizontal table lines
  384.     (entmake
  385.       (list
  386.         (cons 0 "line")
  387.         (cons 8 "Coordinate Table")
  388.         (cons 10 (list (- TXTX (+ ten nocw)) (+ TXTY ht)))
  389.         (cons 11 (list (+ TXTX ten encw) (+ TXTY ht)))
  390.       )
  391.     )
  392.      
  393.     (entmake
  394.       (list
  395.         (cons 0 "line")
  396.         (cons 8 "Coordinate Table")
  397.         (cons 10 (list (- TXTX (+ ten nocw)) (- TXTY ht)))
  398.         (cons 11 (list (+ TXTX ten encw) (- TXTY ht)))
  399.       )
  400.     )
  401.   
  402.   (repeat LEN
  403.         (setq TXTY (- TXTY (* 2 HT)))                        ;;;set new y coord for text
  404.        
  405.         (setq SP (list TXTX TXTY))                        ;;;creates code start point
  406.         (setq CORD (nth CNT CORDS))                        ;;;gets coord from list
  407.         (setq COLEN (strlen CORD))                        ;
  408.         (setq COM 1 GAP 1)       
  409.                        
  410.         (while (/= COLEN COM)                                                ;
  411.                 (setq COM1 (substr CORD COM 1))                                ;finds ',' in strings for
  412.                 (if (and (= COM1 ",") (= GAP 1)) (setq S1 COM GAP 2))        ;spliting string
  413.                 (if (and (= COM1 ",") (= GAP 2)) (setq S2 COM))                ;
  414.                 (setq COM (+ COM 1))                                ;
  415.         ) ;while
  416.        
  417.         (setq CODE (substr CORD 1 (- S1 1)))                ;;;strips of code
  418.         (setq SON (substr CORD (+ S1 1) (- S2 S1 1)))        ;;;strips of north
  419.         (setq SOE (substr CORD (+ S2 1) (- COLEN S2)))        ;;;strips of east
  420.        
  421.         (entmake
  422.           (list
  423.             (cons 0 "text")
  424.             (cons 1 code)
  425.             (cons 7 "Gen-Text")
  426.             (cons 8 "Coordinate Table")
  427.             (cons 10 (list (- TXTX tno) TXTY))
  428.             (cons 11 (list (- TXTX tno) TXTY))
  429.             (cons 40 ht)
  430.             (cons 50 0.0) (cons 72 4)
  431.           )
  432.         )
  433.         
  434.         (entmake
  435.           (list
  436.             (cons 0 "text")
  437.             (cons 1 soe)
  438.             (cons 7 "Gen-Text")
  439.             (cons 8 "Coordinate Table")
  440.             (cons 10 (list TXTX TXTY))
  441.             (cons 11 (list TXTX TXTY))
  442.             (cons 40 ht)
  443.             (cons 50 0.0)
  444.             (cons 72 4)
  445.           )
  446.         )
  447.          
  448.           (entmake
  449.             (list
  450.               (cons 0 "text")
  451.               (cons 1 son) (cons 7 "Gen-Text")
  452.               (cons 8 "Coordinate Table")
  453.               (cons 10 (list (+ TXTX encw) TXTY))
  454.               (cons 11 (list (+ TXTX encw) TXTY))
  455.               (cons 40 ht)
  456.               (cons 50 0.0)
  457.               (cons 72 4)
  458.             )
  459.           )
  460.           
  461.                (entmake
  462.                  (list
  463.                    (cons 0 "line")
  464.                    (cons 8 "Coordinate Table")
  465.                    (cons 10 (list (- TXTX (+ ten nocw)) (- TXTY ht)))
  466.                    (cons 11 (list (+ TXTX ten encw) (- TXTY ht)))
  467.                  )
  468.                ) ;; horizontal lines
  469.        
  470.         (setq hl (entlast)) ; set hl as last horizontal line               
  471.         (setq CNT (+ CNT 1))
  472.        
  473.     ) ;repeat
  474.    
  475.                (setq ly (caddr (assoc 10 (entget hl)))) ;set last y value
  476.                
  477.      ;; place easting & northing vertical table lines
  478.               (entmake
  479.                  (list
  480.                    (cons 0 "line")
  481.                    (cons 8 "Coordinate Table")
  482.                    (cons 10 (list (- fx ten) (+ fy ht)))
  483.                    (cons 11 (list (- fx ten) ly))
  484.                  )
  485.               )
  486.               
  487.               (entmake
  488.                  (list
  489.                    (cons 0 "line")
  490.                    (cons 8 "Coordinate Table")
  491.                    (cons 10 (list (+ fx ten) (+ fy ht)))
  492.                    (cons 11 (list (+ fx ten) ly))
  493.                  )
  494.               )
  495.       
  496.        (entmake
  497.           (list
  498.             (cons 0 "LWPOLYLINE")
  499.             (cons 100 "AcDbEntity")
  500.             (cons 100 "AcDbPolyline")
  501.             (cons 8 "Coordinate Table")
  502.             (cons 90 4)
  503.             (cons 70 1)
  504.             (cons 10 (list (- fx (+ ten nocw)) (+ fy (* ht 4))))
  505.             (cons 10 (list (+ fx (+ ten encw)) (+ fy (* ht 4))))
  506.             (cons 10 (list (+ fx (+ ten encw)) ly))
  507.             (cons 10 (list (- fx (+ ten nocw)) ly))
  508.           )
  509.               ) ; inner rectangle
  510.        (entmake
  511.           (list
  512.             (cons 0 "LWPOLYLINE")
  513.             (cons 100 "AcDbEntity")
  514.             (cons 100 "AcDbPolyline")
  515.             (cons 8 "Coordinate Table")
  516.             (cons 90 4)
  517.             (cons 70 1)
  518.             (cons 10 (list (- fx (+ ten nocw 1)) (+ fy (* ht 4) 1)))
  519.             (cons 10 (list (+ fx (+ ten encw 1)) (+ fy (* ht 4) 1)))
  520.             (cons 10 (list (+ fx (+ ten encw 1)) (- ly 1)))
  521.             (cons 10 (list (- fx (+ ten nocw 1)) (- ly 1)))
  522.           )
  523.               ) ; outer rectangle       
  524. (command "erase" hl "")
  525.   ) ; progn
  526. ) ;if
  527. (command "redraw")
  528. (princ)
  529. ) ; defun
  530. ;;-------------Main function to make List of points-----
  531. (defun c:CRT (/ txtx txty len cord cords cnt sp ht code son soe sox soy so1 encw nocw ten tno lat hl ly fx fy)
  532. (setvar "cmdecho" 0)
  533. (setq temperr *error*)
  534.        (setq *error* trap3)
  535.       
  536. (setq CORDS nil LEN nil CNT 0)        ;;resets coord list to nil
  537. (princ (strcat "\n "))
  538. (initget 1 "All Select")         
  539. (setq sel (strcase (getkword "\Select individual coordinate points or Select All (S or A): ")))
  540. (if (= sel "SELECT") (setq SS (ssget '((2 . "crblk")))) (setq SS (ssget "X" '((2 . "crblk")))))
  541.   
  542. (command "UCS" "WORLD")
  543. (while (/= SS nil)                                        ;;;checks for nil selection
  544.   (setq LEN (sslength SS))
  545.     (repeat LEN
  546.         (setq SO0 (ssname SS CNT))
  547.         (setq CORD (cdr (assoc '10 (entget SO0))))        ;;;gets coords of point
  548.         (setq SOX (rtos (car CORD) 2 3))                ;;;strips off X coord
  549.         (setq SOY (rtos (cadr CORD) 2 3))                ;;;strips off Y coord
  550.         (setq SO1 (entnext SO0))                        ;;;gets attribute entity
  551.         (setq CODE (cdr (assoc '1 (entget SO1))))        ;;;strips off point code from attribute
  552.         (setq CORD (strcat CODE "," SOY "," SOX))        ;;;creates string of code,y,x
  553.         (setq CORDL (list CORD))                        ;;;converts into list
  554.         (if (= CORDS nil) (setq CORDS CORDL) (setq CORDS (append CORDL CORDS)))        ;;;starts new list or adds to old
  555.         (setq CNT (+ CNT 1))
  556.     )
  557.   (setq SS nil)                                                ;;;finishes loop
  558. ) ;while
  559. (command "UCS" "P")
  560. (if (/= (length CORDS) 0) (CRTable))
  561. (setq *error* temperr)
  562. (prompt "\n Coordinate Table is Placed\n © Bijoy Manoharan 2011 www.cadlispandtips.com")
  563. (princ)
  564. ) ;defun
  565. ;;------------- end Main function --------------------
  566. (alert "------------------- Coordinates with Table (Annotative) ----------------------
  567. \n Commands                                          
  568. \n    Command   CN   ( For Increment Coordinate Point Number )
  569. \n    Command   CSN  ( For Increment Coordinate Point Sub Number )
  570. \n    Command   RES  ( To Reset Prefix Text Variable )
  571. \n    Command   CRT  ( To Place Coordinate Table )
  572. \n Steps
  573. \n 1. Enter Prefix Text
  574. \n 2. Enter Starting Number
  575. \n 3. Pick Text Location
  576. \n 4. After Placing Coordinate Points run Command CRT to place table   
  577. \n 5. Type A to select all coordinate points
  578. \n 6. Type S to select individual coordinate points
  579. \n 7. Pick a point to place Coordinate Table.
  580. \nBijoy Manoharan\nSep 2011\nwww.cadlispandtips.com")
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-5 18:52:09 | 显示全部楼层
有很多普林语的例子,这里有一个
 
  1. ; pline co-ords example
  2. ; By Alan H
  3. (defun getcoords (ent)
  4. (vlax-safearray->list
  5.    (vlax-variant-value
  6.      (vlax-get-property
  7.    (vlax-ename->vla-object ent)
  8.    "Coordinates"
  9.      )
  10.    )
  11. )
  12. )
  13. (defun co-ords2xy ()
  14. ; convert now to a list of xy as co-ords are x y x y x y if 3d x y z x y z
  15. (setq len (length co-ords))
  16. (setq numb (/ len 2)) ; even and odd check required
  17. (setq I 0)
  18. (repeat numb
  19. (setq xy (list (nth i co-ords)(nth (+ I 1) co-ords) ))
  20. ; odd (setq xy (list (nth i co-ords)(nth (+ I 1) co-ords)(nth (+ I 2) co-ords) ))
  21. (setq co-ordsxy (cons xy co-ordsxy))
  22. (setq I (+ I 2))
  23. )
  24. )
  25. ; program starts here
  26. (setq co-ords (getcoords (car (entsel "\nplease pick pline"))))
  27. (co-ords2xy) ; list of 2d points making pline
  28. (princ co-ordsxy)
回复

使用道具 举报

55

主题

402

帖子

357

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
274
发表于 2022-7-5 19:09:52 | 显示全部楼层
像这样的。。。。我相信
http://lee-mac.com/polyinfo.html
回复

使用道具 举报

8

主题

14

帖子

6

银币

初来乍到

Rank: 1

铜币
40
发表于 2022-7-5 19:31:57 | 显示全部楼层
 
先生,我想要这样的东西。但我有一个3D对象,我想把第一个3D转换成实体(直线,圆,弧,多段线),然后找到所有坐标,半径。。。
回复

使用道具 举报

2

主题

9

帖子

7

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-5 19:39:07 | 显示全部楼层
谢谢你们,但这不是我想的。
如果有人能编辑现有代码,我将不胜感激!
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-12 13:24 , Processed in 1.080561 second(s), 62 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表