+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
  1. #1
    Full Member
    Using
    AutoCAD 2010
    Join Date
    Sep 2010
    Location
    UAE / India
    Posts
    55

    Default How to create SOLID hatch by using Lisp

    Registered forum members do not see this ad.

    hi,
    Im trying to make a borehole attribute block by using lisp (please see the attachment )
    in this lisp I need to add SOLID hatch as shown in the attached image

    please help me to create this lisp.

    thanks & regads
    bijoy
    Attached Images
    Attached Files

  2. #2
    Forum Deity BlackBox's Avatar
    Using
    Civil 3D 2011
    Join Date
    Nov 2009
    Posts
    3,945

    Default

    Look into the AddHatch Method; pay special attention to the Boundary notes in the Developer Documentation.

    HTH
    "Potential has a shelf life." - Margaret Atwood

  3. #3
    Senior Member GP_'s Avatar
    Using
    AutoCAD 2014
    Join Date
    Oct 2010
    Location
    Vercelli, Italy
    Posts
    141

    Default

    Add in the block definition:

    Code:
    (entmake
      (list
          '(0 . "HATCH")
          '(100 . "AcDbEntity")
          '(67 . 0)
          '(410 . "Model")
          '(8 . "0")
          '(100 . "AcDbHatch")
          '(10 0.0 0.0 0.0)
          '(210 0.0 0.0 1.0)
          '(2 . "SOLID")
          '(70 . 1)
          '(71 . 0)
          '(91 . 1)
          '(92 . 7)
          '(72 . 1)
          '(73 . 1)
          '(93 . 3)
          '(10 0.0 2.0 0.0)
          '(42 . 0.414214)
          '(10 -2.0 0.0 0.0)
          '(42 . 0.0)
          '(10 0.0 0.0 0.0)
          '(42 . 0.0)
          '(97 . 0)
          '(75 . 1)
          '(76 . 1)
          '(47 . 0.0131804)
          '(98 . 1)
          '(10 -1.38935 0.623746 0.0)
        )
    )
     
    (entmake
      (list
          '(0 . "HATCH")
          '(100 . "AcDbEntity")
          '(67 . 0)
          '(410 . "Model")
          '(8 . "0")
          '(100 . "AcDbHatch")
          '(10 0.0 0.0 0.0)
          '(210 0.0 0.0 1.0)
          '(2 . "SOLID")
          '(70 . 1)
          '(71 . 0)
          '(91 . 1)
          '(92 . 7)
          '(72 . 1)
          '(73 . 1)
          '(93 . 3)
          '(10 2.0 0.0 0.0)
          '(42 . 0.0)
          '(10 0.0 0.0 0.0)
          '(42 . 0.0)
          '(10 0.0 -2.0 0.0)
          '(42 . 0.414214)
          '(97 . 0)
          '(75 . 1)
          '(76 . 1)
          '(47 . 0.0131804)
          '(98 . 1)
          '(10 0.839759 -0.628394 0.0)
        )
     )

  4. #4
    Full Member
    Using
    AutoCAD 2010
    Join Date
    Sep 2010
    Location
    UAE / India
    Posts
    55

    Default

    Thank you so much GP, you made my day..

  5. #5
    Senior Member
    Computer Details
    VVA's Computer Details
    Operating System:
    Windows 7
    CPU:
    Intel Core i5-2400
    RAM:
    8 Gb
    Graphics:
    Nvidia Quadro 600
    Primary Storage:
    Seagate 500 GB + WD 750 GB
    Monitor:
    Philips 27"
    Using
    AutoCAD 2013
    Join Date
    Dec 2006
    Location
    Minsk, Belarus
    Posts
    401

    Default

    Look here
    Code:
    (defun entmakex-hatch (L a n s)
     ;; By ElpanovEvgeniy
     ;; L - list point
     ;; A - angle hatch
     ;; N - name pattern
     ;; S - scale

  6. #6
    Full Member
    Using
    AutoCAD 2010
    Join Date
    Sep 2010
    Location
    UAE / India
    Posts
    55

    Default

    thanks VVA

  7. #7
    Full Member
    Using
    AutoCAD 2010
    Join Date
    Sep 2010
    Location
    UAE / India
    Posts
    55

    Default

    hi,
    Im trying to learn how to make solid hatch by enmake method. as a practice I tried to create a rectangular solid hatch, but it is always showing errors. can you check the below code and please let me know the mistake I did in it. and let me know which values we can ignore.

    thanks & regards
    bijoy.

    Code:
    (defun c:tp ( )
                (entmake
             (list
      
                        '(0 . "HATCH") 
                        '(100 . "AcDbEntity") 
                        '(67 . 0) 
                        '(410 . "Model") 
                        '(8 . "0") 
                        '(100 . "AcDbHatch") 
                        '(10 0.0 0.0 0.0) 
                        '(210 0.0 0.0 1.0) 
                        '(2 . "SOLID") 
                        '(70 . 1) 
                        '(71 . 1) 
                        '(91 . 1) 
                        '(92 . 7) 
                        '(72 . 0) 
                        '(73 . 1) 
                        '(93 . 4) 
                        '(10 0.0 2.0 0.0) 
                        '(10 -2.0 2.0 0.0) 
                        '(10 -2.0 0.0 0.0) 
                        '(10 0.0 0.0 0.0) 
                        '(97 . 3) 
                        '(75 . 1) 
                        '(76 . 1) 
                        '(47 . 0.0261891) 
                        '(98 . 1) 
                        '(10 -0.973791 0.503782 0.0) 
                        '(450 . 0) 
                        '(451 . 0) 
                        '(460 . 0.0) 
                        '(461 . 0.0) 
                        '(452 . 1) 
                        '(462 . 1.0) 
                        '(453 . 2) 
                        '(463 . 0.0) 
                        '(63 . 5) 
                        '(421 . 255) 
                        '(463 . 1.0) 
                        '(63 . 7) 
                        '(421 . 16777215) 
                        '(470 . "LINEAR")
                    )
         )
                
          
        (princ)
    )

  8. #8
    Senior Member
    Computer Details
    VVA's Computer Details
    Operating System:
    Windows 7
    CPU:
    Intel Core i5-2400
    RAM:
    8 Gb
    Graphics:
    Nvidia Quadro 600
    Primary Storage:
    Seagate 500 GB + WD 750 GB
    Monitor:
    Philips 27"
    Using
    AutoCAD 2013
    Join Date
    Dec 2006
    Location
    Minsk, Belarus
    Posts
    401

    Default

    Code:
    (defun entmakex-solidhatch ( L )
      ;; L - list of list point. like ((pt11 pt12 pt13)(pt21 pt22 pt23))
      ;; Use
    ;;;(entmakex-solidhatch
    ;;;    (list
    ;;;      (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget (car (entsel "\nSelect Polyline:")))))
    ;;;      );_  list
    ;;;    )
      (entmakex
      (apply
       'append
       (list
        (list '(0 . "HATCH")
              '(100 . "AcDbEntity")
              '(410 . "Model")
              '(100 . "AcDbHatch")
              '(10 0.0 0.0 0.0)
              '(210 0.0 0.0 1.0)
              (cons 2 "SOLID")
              '(70 . 1)
              '(71 . 0)
              (cons 91 (length L))
        ) ;_  list
        (apply 'append
               (mapcar '(lambda (a)
                         (apply 'append
                                (list (list '(92 . 7) '(72 . 0) '(73 . 1) (cons 93 (length a)))
                                      (mapcar '(lambda (b) (cons 10 b)) a)
                                      '((97 . 0))
                                ) ;_  list
                         ) ;_  apply
                        ) ;_  lambda
                       L
               ) ;_  mapcar
        ) ;_  apply
        (list '(75 . 0)
              '(76 . 1)
              '(47 . 1.)
              '(98 . 2)
              '(10 0. 0. 0.0)
              '(10 0. 0. 0.0)
              '(450 . 0)
              '(451 . 0)
              '(460 . 0.0)
              '(461 . 0.0)
              '(452 . 0)
              '(462 . 0.0)
              '(453 . 2)
              '(463 . 0.0)
              '(63 . 256)
              '(463 . 1.0)
              '(63 . 256)
              '(470 . "LINEAR")
        ) ;_  list
       ) ;_  list
      ) ;_  apply
    )
      )
    Use
    Code:
    (entmakex-solidhatch
      (list
      (list
        '(0.0 2.0 0.0)
        '(-2.0 2.0 0.0)
        '(-2.0 0.0 0.0)
        '(0.0 0.0 0.0)
        )
            )
      )
    Important
    ;; L - list of list point. like ((pt11 pt12 pt13)(pt21 pt22 pt23))

  9. #9
    Full Member
    Using
    AutoCAD 2010
    Join Date
    Sep 2010
    Location
    UAE / India
    Posts
    55

    Default

    thanks VVA for your reply, actually I want to make a trial pit block by lisp almost same as borehole block made in previous discussions. mr GP_ help me create a solid hatch in that. but when im trying to make solid hatch in new lisp its not working. so need help to complete this attached lisp as shown in attached image. and please let me know the important thinks while making entmake function.

    tp.jpg
    Code:
       
        ;;===============================================;;
        ;; Example by Lee Mac 2011  -  www.lee-mac.com   ;;
        ;;===============================================;;
    
    (defun c:tpb ( )
        
        (if (not (tblsearch "BLOCK" "TPBLK"))
            (progn
                (if (not (tblsearch "STYLE" "Gen-Text"))
                    (entmake
                        (list
                            (cons 0 "STYLE")
                            (cons 100 "AcDbSymbolTableRecord")
                            (cons 100 "AcDbTextStyleTableRecord")
                            (cons 2 "Gen-Text")
                            (cons 70 0)
                            (cons 40 2.5)
                            (cons 3 "Arial.ttf")
                        )
                    )
                )
                
                (entmake
                    (list
                        (cons 0 "BLOCK")
                        (cons 8 "0")
                        (cons 370 0)
                        (cons 2 "TPBLK")
                        (cons 70 2)
                        (cons 4 "Block to Place Trial pit Locations")
                        (list 10 0.0 0.0 0.0)
                    )
                )
                (entmake
                   (list
                       (cons 0 "LWPOLYLINE")
                       (cons 100 "AcDbEntity")
                       (cons 100 "AcDbPolyline")
                       (cons 8 "0")
                       (cons 90 4)
                       (cons 70 1)
                       (list 10 -2.0 2.0)
                       (list 10  2.0 2.0)
                       (list 10  2.0 -2.0)
                       (list 10 -2.0 -2.0)
                   )
                )
                
                (entmake
                    (list
                        (cons 0 "LINE")
                        (cons 8 "0")
                        (cons 6 "Continuous")
                        (cons 370 0)
                        (list 10 0.0 -3.0 0.0)
                        (list 11 0.0 3.0 0.0)                    
                    )
                )
                
                (entmake
                    (list
                        (cons 0 "LINE")
                        (cons 8 "0")
                        (cons 6 "Continuous")
                        (cons 370 0)
                        (list 10 -3.0 0.0 0.0)
                        (list 11 3.0 0.0 0.0)                    
                    )
                )            
        
                (entmake
                    (list
                        (cons 0 "ATTDEF")
                        (cons 8 "0")
                        (cons 370 0)
                        (cons 7 "Gen-Text")
                        (list 10 2.5 3.5 0.0)
                        (list 11 2.5 3.5 0.0)
                        (cons 40 3.5)
                        (cons 1 "TP-00")
                        (cons 3 "Trial pit Location")
                        (cons 2 "TP")
                        (cons 70 0)
                        (cons 72 0)
                        (cons 74 2)
                    )
                )
                
                (entmake
                    (list
                        (cons 0 "ENDBLK")
                        (cons 8 "0")
                    )
                )
              
            )
        )
    
        (princ)
    )


    thanks & regards
    bijoy.v.m

  10. #10
    Senior Member
    Computer Details
    VVA's Computer Details
    Operating System:
    Windows 7
    CPU:
    Intel Core i5-2400
    RAM:
    8 Gb
    Graphics:
    Nvidia Quadro 600
    Primary Storage:
    Seagate 500 GB + WD 750 GB
    Monitor:
    Philips 27"
    Using
    AutoCAD 2013
    Join Date
    Dec 2006
    Location
    Minsk, Belarus
    Posts
    401

    Default

    Registered forum members do not see this ad.

    Code:
    (defun c:tpb ( )
        
        (if (not (tblsearch "BLOCK" "TPBLK"))
            (progn
                (if (not (tblsearch "STYLE" "Gen-Text"))
                    (entmake
                        (list
                            (cons 0 "STYLE")
                            (cons 100 "AcDbSymbolTableRecord")
                            (cons 100 "AcDbTextStyleTableRecord")
                            (cons 2 "Gen-Text")
                            (cons 70 0)
                            (cons 40 2.5)
                            (cons 3 "Arial.ttf")
                        )
                    )
                )
                
                (entmake
                    (list
                        (cons 0 "BLOCK")
                        (cons 8 "0")
                        (cons 370 0)
                        (cons 2 "TPBLK")
                        (cons 70 2)
                        (cons 4 "Block to Place Trial pit Locations")
                        (list 10 0.0 0.0 0.0)
                    )
                )
                (entmake
                   (list
                       (cons 0 "LWPOLYLINE")
                       (cons 100 "AcDbEntity")
                       (cons 100 "AcDbPolyline")
                       (cons 8 "0")
                       (cons 90 4)
                       (cons 70 1)
                       (list 10 -2.0 2.0)
                       (list 10  2.0 2.0)
                       (list 10  2.0 -2.0)
                       (list 10 -2.0 -2.0)
                   )
                )
                
                (entmake
                    (list
                        (cons 0 "LINE")
                        (cons 8 "0")
                        (cons 6 "Continuous")
                        (cons 370 0)
                        (list 10 0.0 -3.0 0.0)
                        (list 11 0.0 3.0 0.0)                    
                    )
                )
                
                (entmake
                    (list
                        (cons 0 "LINE")
                        (cons 8 "0")
                        (cons 6 "Continuous")
                        (cons 370 0)
                        (list 10 -3.0 0.0 0.0)
                        (list 11 3.0 0.0 0.0)                    
                    )
                )            
        
                (entmake
                    (list
                        (cons 0 "ATTDEF")
                        (cons 8 "0")
                        (cons 370 0)
                        (cons 7 "Gen-Text")
                        (list 10 2.5 3.5 0.0)
                        (list 11 2.5 3.5 0.0)
                        (cons 40 3.5)
                        (cons 1 "TP-00")
                        (cons 3 "Trial pit Location")
                        (cons 2 "TP")
                        (cons 70 0)
                        (cons 72 0)
                        (cons 74 2)
                    )
                )
                (entmakex-solidhatch
                  (list
                    (list
                      '(0.0 2.0 0.0)
                      '(-2.0 2.0 0.0)
                      '(-2.0 0.0 0.0)
                      '(0.0 0.0 0.0)
                      )
                    (list
                      '(2.0 0.0 0.0)
                      '(2.0 -2.0 0.0)
                      '(0.0 -2.0 0.0)
                      '(0.0 0.0 0.0)
                      )
                   )
                  )
                (entmake
                    (list
                        (cons 0 "ENDBLK")
                        (cons 8 "0")
                    )
                )
              
            )
        )
    
        (princ)
    )
    entmakex-solidhatch get from #8

Similar Threads

  1. Solid to hatch solid
    By KJB in forum AutoCAD 3D Modelling & Rendering
    Replies: 16
    Last Post: 6th Oct 2010, 05:34 am
  2. Help---how to create this solid model
    By super in forum AutoCAD 3D Modelling & Rendering
    Replies: 12
    Last Post: 22nd Feb 2010, 03:39 pm
  3. Solid Hatch not Solid :(
    By CadGuy2009 in forum AutoCAD General
    Replies: 5
    Last Post: 11th Apr 2009, 08:39 pm
  4. Lisp to draw an outline around solid surface (hatch) then removes solid?
    By sim_rx3 in forum AutoLISP, Visual LISP & DCL
    Replies: 6
    Last Post: 21st Oct 2008, 03:50 am
  5. Create surface to 3d solid?
    By therock005 in forum AutoCAD 3D Modelling & Rendering
    Replies: 15
    Last Post: 24th Jun 2008, 11:50 am

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