+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 16
  1. #1
    Junior Member
    Discipline
    Surveying
    Using
    AutoCAD 2018
    Join Date
    Feb 2018
    Posts
    15

    Wink Help editing a LISP

    Registered forum members do not see this ad.

    Hi all,

    I would like some AutoLISP Expert to give me some advice and if possible help to edit the following LISP.

    the first .LSP makes several rectangles to parti of 3 posts and works perfectly !!

    until some adjustments that were made to get the second .LSP, the problem is precisely that.

    this .LSP has several problems the first is that it loses the essence of the first, the rectangles made from it, depending on the

    so that the points P1 P2 P3 are picked up, the rectangles are incorrectly made, also if the units of measure, are changed

    the program has some bugs,

    I also think the program is kinda heavy, it crashes every time we run the program.

    if these problems were solved it would already be PERFECT.

    but we will correct some more problems and if it were possible I would like to make some improvements.

    I would like the rectangle of the "LAND" to be in the "CYAN" color and all others in the "RED" color.

    2º the "CYAN" rectangle Stay on layer "01" and the "RED" rectangles stay on layer "02".

    3 and the labels inside the rectangles ("00" "00 * blue color" "Construction" "Terrain") lay on layers 03 04 05 06 in the exact color of the label.

    4th after all the rectangles I will explode and would like it to be in the layers mentioned above.


    Thanks in advance for your help, and apologies for English, I live in Brazil and the translator does not translate correctly.

    ///////////////////////////// LISP 01 /////////////////////////////


    Code:
    (defun c:Subdivide ( / *error* vars vals p1 p2 p3 p4 ang n w)
    (gc)
    (vl-load-com)
    (or *acad* (setq *acad* (vlax-get-acad-object)))
    (or *doc* (setq *doc* (vla-get-ActiveDocument *acad*)))
    (defun *error* (error)
    (mapcar 'setvar vars vals)
    (vla-endundomark *doc*)
    (cond
    ((not error))
    ((wcmatch (strcase error) "*QUIT*,*CANCEL*"))
    (1 (princ (strcat "\nERROR: " error)))
    )
    (princ)
    )
    (vla-endundomark *doc*)
    (vla-startundomark *doc*)
    (setq vars '("cmdecho" "osmode"))
    (setq vals (mapcar 'getvar vars))
    (mapcar 'setvar vars '(0 0))
    (command "_.expert" (getvar "expert")) ;; dummy command
    (and
    (setq p1 (getpoint "\nP1 <Início da Edificação>: "))
    (setq p2 (getpoint p1 "\nP2 <Comprimento da Edificação>: "))
    (setq p3 (getpoint p2 "\nP3 <Comprimento da Quadra>: "))
    (or
    (not (equal (angle p1 p2)(angle p1 p3) 1e-4))
    (alert "\nPoints are all in a straight line.")
    )
    (not (initget 7))
    (setq n (getint "\nEnter quantity of parcels to create: "))
    (setq ang (angle p2 p3))
    (setq w (/ (distance p2 p3) n))
    (repeat n
    (setq p3 (polar p2 ang w)
    p4 (polar p1 ang w)
    )
    (vl-cmdf "_.pline" p2 p3 p4 p1 "_C")
    (setq p2 p3 p1 p4)
    )
    )
    (*error* nil)
    )
    (defun c:SD ()(c:Subdivide))
    ///////////////////////////// LISP 02 /////////////////////////////


    Code:
    (defun c:Subdivide( / *error* bmakerec3vs vars vals ucsf p1 p2 p3 k n w h bnn )
      (gc)
      (vl-load-com)
      (or *acad* (setq *acad* (vlax-get-acad-object)))
      (or *doc* (setq *doc* (vla-get-ActiveDocument *acad*)))
      (defun *error* ( error )
        (mapcar 'setvar vars vals)
        (if ucsf
          (command-s "_.UCS" "_P")
        )
        (vla-endundomark *doc*)
        (cond
          ((not error))
          ((wcmatch (strcase error) "*QUIT*,*CANCEL*"))
          (1 (princ (strcat "\nERROR: " error)))
        )
        (princ)
      )
    
      (defun bmakerec3vs ( w h ts bn / p ss )
        (setq ss (ssadd))
        (vl-cmdf "_.RECTANGLE" '(0.0 0.0) (list w h))
        (ssadd (entlast) ss)
        (setq p (list (/ w 4.0) (/ h 2.0)))
        (vl-cmdf "_.TEXT" "_J" "_ML" p ts "" "00")
        (ssadd (entlast) ss)
        (vl-cmdf "_.BLOCK" bn '(0.0 0.0) ss)
        (while (< 0 (getvar 'cmdactive)) (vl-cmdf ""))
        (if (or (not (entlast)) (and (entlast) (not (ssmemb (entlast) ss))))
          (progn
            (vl-cmdf "_.INSERT" bn '(0.0 0.0))
            (while (< 0 (getvar 'cmdactive)) (vl-cmdf ""))
          )
        )
        
        (vl-cmdf "_.BEDIT" bn)
        (while (< 0 (getvar 'cmdactive)) (vl-cmdf ""))
        (vl-cmdf "_.CHANGE" "_ALL" "" "_P" "_C" "3")
        (while (< 0 (getvar 'cmdactive)) (vl-cmdf ""))
        (vl-cmdf "_.BPARAMETER" "_V" p)
        (while (< 0 (getvar 'cmdactive)) (vl-cmdf ""))
        (vl-cmdf "_.-BVSTATE" "_N" "Edificações" "_C")
        (vl-cmdf "_.-BVSTATE" "_D" "VisibilityState0")
        (vl-cmdf "_.-BVSTATE" "_N" "Construções" "_H")
        (setq ss (ssadd))
        (vl-cmdf "_.RECTANGLE" '(0.0 0.0) (list w h))
        (ssadd (entlast) ss)
        (vl-cmdf "_.TEXT" "_J" "_ML" p ts "" "Construção")
        (ssadd (entlast) ss)
        (vl-cmdf "_.CHANGE" ss "" "_P" "_C" "2")
        (while (< 0 (getvar 'cmdactive)) (vl-cmdf ""))
        (vl-cmdf "_.-BVSTATE" "_N" "Terrenos" "_H")
        (setq ss (ssadd))
        (vl-cmdf "_.RECTANGLE" '(0.0 0.0) (list w h))
        (ssadd (entlast) ss)
        (vl-cmdf "_.TEXT" "_J" "_ML" p ts "" "Terreno")
        (ssadd (entlast) ss)
        (vl-cmdf "_.CHANGE" ss "" "_P" "_C" "4")
        (while (< 0 (getvar 'cmdactive)) (vl-cmdf ""))
        (while (< 0 (getvar 'cmdactive)) (vl-cmdf ""))
        (vl-cmdf "_.-BVSTATE" "_N" "Comércios" "_H")
        (setq ss (ssadd))
        (vl-cmdf "_.RECTANGLE" '(0.0 0.0) (list w h))
        (ssadd (entlast) ss)
        (vl-cmdf "_.TEXT" "_J" "_ML" p ts "" "00")
        (ssadd (entlast) ss)
        (vl-cmdf "_.CHANGE" ss "" "_P" "_C" "5")
        (while (< 0 (getvar 'cmdactive)) (vl-cmdf ""))
        (vl-cmdf "_.BCLOSE")
        (while (< 0 (getvar 'cmdactive)) (vl-cmdf ""))
        (princ)
      )
    
      (or *k* (setq *k* 0))
      (vla-endundomark *doc*)
      (vla-startundomark *doc*)
      (if (= 0 (getvar 'worlducs))
        (progn
          (vl-cmdf "_.UCS" "_W")
          (setq ucsf t)
        )
      )
      (setq vars '("cmdecho" "osmode"))
      (setq vals (mapcar 'getvar vars))
      (mapcar 'setvar vars '(0 0))
      (if
        (and
          (setq p1 (getpoint "\nP1 <Início da Edificação>: "))
          (setq p2 (getpoint p1 "\nP2 <Comprimento da Edificação>: "))
          (setq p3 (getpoint p2 "\nP3 <Comprimento da Quadra>: "))
          (or
            (not (equal (angle p1 p2) (angle p1 p3) 1e-4))
            (alert "\nPoints are all in a straight line.")
          )
          (not (initget 7))
          (setq n (getint "\nQuantidade de Edificações ou Lotes: "))
          (setq h (/ (distance p2 p3) n))
          (setq w (distance p1 p2))
        )
        (progn
          (bmakerec3vs w h (/ h 4.0) (setq bnn (strcat "rec" (itoa (setq *k* (1+ *k*)))))) ;;;; Especifique diferentes textos em vez de (/ h 4.0) e seu nome exclusivo para bloco em vez de "rec" (você pode deixá-lo como novos nomes de blocos serão criados de acordo com o incremento da variável global * k *)
          (entdel (entlast))
          (vl-cmdf "_.UCS" "_3P" p2 p1)
          (while (< 0 (getvar 'cmdactive)) (vl-cmdf ""))
          (setq k -1)
          (repeat n
            (vl-cmdf "_.INSERT" bnn (list 0.0 (* h (setq k (1+ k)))))
            (while (< 0 (getvar 'cmdactive)) (vl-cmdf ""))
          )
          (vl-cmdf "_.UCS" "_P")
        )
      )
      (*error* nil)
    )
    
    (defun c:SD nil (c:Subdivide))
    Attached Files
    Last edited by SLW210; 6th Feb 2018 at 12:30 pm. Reason: Added Code Tags!

  2. #2
    Junior Member
    Discipline
    Surveying
    Using
    AutoCAD 2018
    Join Date
    Feb 2018
    Posts
    15

    Default Help editing a LISP

    Hi all,

    I would like some AutoLISP Expert to give me some advice and if possible help to edit the following LISP.

    the first .LSP makes several rectangles to parti of 3 posts and works perfectly !!

    until some adjustments that were made to get the second .LSP, the problem is precisely that.

    this .LSP has several problems the first is that it loses the essence of the first, the rectangles made from it, depending on the

    so that the points P1 P2 P3 are picked up, the rectangles are incorrectly made, also if the units of measure, are changed

    the program has some bugs,

    I also think the program is kinda heavy, it crashes every time we run the program.

    if these problems were solved it would already be PERFECT.

    but we will correct some more problems and if it were possible I would like to make some improvements.

    I would like the rectangle of the "LAND" to be in the "CYAN" color and all others in the "RED" color.

    2º the "CYAN" rectangle Stay on layer "01" and the "RED" rectangles stay on layer "02".

    3 and the labels inside the rectangles ("00" "00 * blue color" "Construction" "Terrain") lay on layers 03 04 05 06 in the exact color of the label.

    4th after all the rectangles I will explode and would like it to be in the layers mentioned above.


    Thanks in advance for your help, and apologies for English, I live in Brazil and the translator does not translate correctly.
    Attached Files

  3. #3
    Senior Member devitg's Avatar
    Computer Details
    devitg's Computer Details
    Operating System:
    XP
    Monitor:
    VG2021WM VIEW SONIC
    Using
    AutoCAD 2008
    Join Date
    Apr 2005
    Location
    CORDOBA ARGENTINA
    Posts
    170

    Default contact me

    Hola Junior, espero nos podamos entender en Portuñol, JEJE

    Por favor sube el dwg que has utilizado con el LiSP


    devitg@gmail.com
    Last edited by devitg; 6th Feb 2018 at 02:49 am. Reason: add e-mail

  4. #4
    Super Moderator SLW210's Avatar
    Computer Details
    SLW210's Computer Details
    Operating System:
    Windows 7 PRO 64-bit
    Computer:
    IBM Lenovo
    Motherboard:
    ACPI x64
    CPU:
    Pentium(R) i5 4570 @ 3.2GHz
    RAM:
    8 GB RAM
    Graphics:
    Nvidia Quadro 600 1GB
    Primary Storage:
    300 GB
    Secondary Storage:
    650GB
    Monitor:
    2x ThinkVision 24"
    Discipline
    Multi-disciplinary
    SLW210's Discipline Details
    Occupation
    Design Draftsman
    Discipline
    Multi-disciplinary
    Details
    Mostly do drafting related to manufacturing. From doing site layouts with proposed updates, additions and renovations to be budgeted and submitted for bid, to updating and changing existing drawings to reflect maintenance and repair/revision work done on site.
    Using
    AutoCAD 2018
    Join Date
    May 2007
    Location
    South Florida, USA
    Posts
    12,084

    Default

    Please read the Code Posting Guidelines and in the future place your Code in Code Tags.[CODE]Your Code Here[/CODE] =
    Code:
    Your Code Here
    “A narrow mind and a fat head invariably come on the same person” Zig Zigler



  5. #5
    Junior Member
    Discipline
    Surveying
    Using
    AutoCAD 2018
    Join Date
    Feb 2018
    Posts
    15

    Default

    OK thank you.

  6. #6
    Junior Member
    Discipline
    Surveying
    Using
    AutoCAD 2018
    Join Date
    Feb 2018
    Posts
    15

    Default

    Oi @@ obrigado pela a ajuda, vou tentar me expressar melhor em portugues ou espanhou,
    o que estou querendo é uma tarefa um pouco complicada no meu ponto de vista.
    é assim tenho duas .lisp a primeira é a inicial, ela funciona perfeitamente, vou adicionar o video com o nome (video "primeira LSP" )
    faz os retangulos sempre corretos como pode vê no video.

    foram feitas algumas alterações e o resultado foi a segunda lisp, ela conta com alguns problemas, bugs entre outros, eu gostaria que a segunda mantesse o mesmo principio da primeira. se conseguir fazer isso, já estaria perfeito. (video "segunda LSP")
    alem do fato de que se for alterada a unidade de medida ela apresenta um bug.

    https://drive.google.com/file/d/1P2q...-pvCT_DIP/view

    https://drive.google.com/file/d/1Z91...0mw-cXp05/view

  7. #7
    Super Member
    Using
    not applicable
    Join Date
    Jun 2016
    Posts
    669

    Default

    @JuniorNogueira:
    Why do you post the same problem twice?
    BricsCAD 18

  8. #8
    Junior Member
    Discipline
    Surveying
    Using
    AutoCAD 2018
    Join Date
    Feb 2018
    Posts
    15

    Default

    unintentionally. is my first post and I do not understand the site well.

  9. #9
    Super Moderator SLW210's Avatar
    Computer Details
    SLW210's Computer Details
    Operating System:
    Windows 7 PRO 64-bit
    Computer:
    IBM Lenovo
    Motherboard:
    ACPI x64
    CPU:
    Pentium(R) i5 4570 @ 3.2GHz
    RAM:
    8 GB RAM
    Graphics:
    Nvidia Quadro 600 1GB
    Primary Storage:
    300 GB
    Secondary Storage:
    650GB
    Monitor:
    2x ThinkVision 24"
    Discipline
    Multi-disciplinary
    SLW210's Discipline Details
    Occupation
    Design Draftsman
    Discipline
    Multi-disciplinary
    Details
    Mostly do drafting related to manufacturing. From doing site layouts with proposed updates, additions and renovations to be budgeted and submitted for bid, to updating and changing existing drawings to reflect maintenance and repair/revision work done on site.
    Using
    AutoCAD 2018
    Join Date
    May 2007
    Location
    South Florida, USA
    Posts
    12,084

    Default

    Please use English.
    “A narrow mind and a fat head invariably come on the same person” Zig Zigler



  10. #10
    Super Member
    Computer Details
    ronjonp's Computer Details
    Operating System:
    Windows 10
    Using
    AutoCAD 2018
    Join Date
    Apr 2009
    Location
    Colorado
    Posts
    838

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by SLW210 View Post
    Please use English.
    Is this a 'rule'? I'm pretty sure he was talking to devitg which speaks the same language.

Similar Threads

  1. Editing LISP to accept an argument
    By broncos15 in forum AutoLISP, Visual LISP & DCL
    Replies: 7
    Last Post: 12th Jan 2016, 09:38 pm
  2. LISP Editing Help
    By rikiki in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 4th Aug 2015, 04:08 am
  3. Editing block with lisp
    By Lukijan in forum AutoLISP, Visual LISP & DCL
    Replies: 12
    Last Post: 7th Jul 2012, 10:27 am
  4. Help editing this LISP
    By Rooster in forum AutoLISP, Visual LISP & DCL
    Replies: 15
    Last Post: 21st Feb 2008, 11:00 pm
  5. Need help with editing lisp routine
    By romparkin in forum AutoLISP, Visual LISP & DCL
    Replies: 17
    Last Post: 3rd Apr 2007, 08:02 am

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts