+ Reply to Thread
Results 1 to 10 of 10
  1. #1
    Forum Newbie
    Discipline
    Electrical
    Using
    AutoCAD 2017
    Join Date
    Jan 2017
    Posts
    8

    Default VBA CODE-From multiple areas to plot in model space to create a layout for each areas

    Registered forum members do not see this ad.

    Hi everybody,
    I have a big problem....
    I have about 100 DWG with a lot of sheet in the same model space and i must print every sheet, so i am looking for a script in VBA or lisp to create from multiple areas to plot in model space, a layout tab for each area vba autocad.
    I found a lisp script, but it doesn't run (plotDWGarr).
    (http://www.cadforum.cz/cadforum_en/p...rawing-tip7585)

    Do you know another similar script o to write a VBA to do it?

    Thank you very much in advance

  2. #2
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,738

    Default

    If I understand correct this will plot all sheets in model space rather than trying to redo all of them.

    Code:
    ; plot multi title block in Model space 
    ; By Alan H 2013
     (PROMPT ".....PRINTING DRAWING TO plotter....")
    (setq oldsnap (getvar "osmode"))
    (setvar "osmode" 0)
     
    (setq ss2 (ssget "x" '((0 . "INSERT")(2 . "Da1drsht"))))
    (setq n (sslength ss2))
    (setq index 0)
    (repeat n
        (setq en (ssname ss2 index))
        (setq el (entget en))
        (setq inspt (assoc 10 el)) ; insertion pt
       (setq xmin (- (cadr inspt) 6.0))
       (setq ymin (- (caddr inspt) 6.0))
       (setq xymin (strcat (rtos xmin 2 1) "," (rtos ymin 2 1)))
       (setq xmax (+ xmin 813.0)) ; hard coded for 813 wide 6mm offset
       (setq ymax (+ ymin 566.0)) ;hard code for 566 high
       (setq xymax (strcat (rtos xmax 2 1) "," (rtos ymax 2 1)))
     
      (COMMAND "-PLOT"  "Y"     "" "//PRODPRN01/Design-5100"
            "A3" "M"     "LANDSCAPE"   "N"
            "W"   xymin   xymax "1=2"  "C"
            "y"   "Designlaser.ctb"      "Y"   "" "n"   "n"
            "y" "N" "N" "Y"
        )
     
      (setq index (+ index 1))
    )
    (setvar "osmode" oldsnap)
    (princ)
    Last edited by BIGAL; 19th Jan 2017 at 07:19 am.
    A man who never made mistakes never made anything

  3. #3
    Senior Member
    Using
    AutoCAD 2009
    Join Date
    Oct 2012
    Posts
    290

    Default

    FrancescoITA
    Add example file.

  4. #4
    Forum Newbie
    Discipline
    Electrical
    Using
    AutoCAD 2017
    Join Date
    Jan 2017
    Posts
    8

    Default

    For Bigal:

    Thank you very much Bigal, after i will try if it runs or no.
    However i prefer use a VBA for this script

    For Maratovich:
    Excuse me, here the example.
    Attached Files

  5. #5
    Senior Member
    Using
    AutoCAD 2009
    Join Date
    Oct 2012
    Posts
    290

    Default

    Look at the options of this topic, there is a solution.
    http://www.cadtutor.net/forum/showth...om-model-space
    http://www.cadtutor.net/forum/showth...ser-paper-size

    You need to batch printing or creating layouts ?

  6. #6
    Forum Newbie
    Discipline
    Electrical
    Using
    AutoCAD 2017
    Join Date
    Jan 2017
    Posts
    8

    Default

    For Bigal:

    Excuse me Bigal for my ignorance, but how can i use your script, because i tried, but AutoCad told me that there are some problems.

    Can you tell me what steps i must do to load and to use your script??^^

    Thank you very much .

  7. #7
    Forum Newbie
    Discipline
    Electrical
    Using
    AutoCAD 2017
    Join Date
    Jan 2017
    Posts
    8

    Default

    I am interested in both thing, but more to create layout.

  8. #8
    Senior Member
    Using
    AutoCAD 2009
    Join Date
    Oct 2012
    Posts
    290

    Default

    Quote Originally Posted by FrancescoITA View Post
    I am interested in both thing, but more to create layout.
    Batch Printing example:
    https://youtu.be/-zVWtNBjPLE

  9. #9
    Forum Newbie
    Discipline
    Electrical
    Using
    AutoCAD 2017
    Join Date
    Jan 2017
    Posts
    8

    Default

    maratovich....it is a payment tool....I want create a tool with VBA and i would pay ....

  10. #10
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,738

    Default

    Registered forum members do not see this ad.

    Some bits you need to change are shown in red, copy and paste my 1st post to Notepad save as "Plot-Multi-Mspace.lsp". make changes to the code as shown below, post a dwg with say two title blocks a RAR is a nuisance for me then could change code for you.

    To run type Appload and pick the lisp Load & close it should run.

    Code:
    ; plot multi title block in Model space 
    ; By Alan H 2013
     (PROMPT ".....PRINTING DRAWING TO plotter....")
    (setq oldsnap (getvar "osmode"))
    (setvar "osmode" 0)
     
    (setq ss2 (ssget "x" '((0 . "INSERT")(2 . "Da1drsht")))) ; title block name
    (setq n (sslength ss2))
    (setq index 0)
    (repeat n
        (setq en (ssname ss2 index))
        (setq el (entget en))
        (setq inspt (assoc 10 el)) ; insertion pt of title block
       (setq xmin (- (cadr inspt) 6.0)) ; offset pt lower left
       (setq ymin (- (caddr inspt) 6.0))
       (setq xymin (strcat (rtos xmin 2 1) "," (rtos ymin 2 1)))
       (setq xmax (+ xmin 813.0)) ; hard coded for 813 wide 6mm offset
       (setq ymax (+ ymin 566.0)) ;hard code for 566 high
       (setq xymax (strcat (rtos xmax 2 1) "," (rtos ymax 2 1)))
    ; scale 1=2 is for an A1 sheet plotted on A3 paper
    ; dwg to pdf means we can check if it works rather than waste paper
      (COMMAND "-PLOT"  "Y"     "" "DWG to PDF"
            "A3" "M"     "LANDSCAPE"   "N"
            "W"   xymin   xymax "1=2"  "C"
            "y"   "Designlaser.ctb"      "Y"   "" "n"   "n"
            "y" "N" "N" "Y"
        )
     
      (setq index (+ index 1))
    )
    (setvar "osmode" oldsnap)
    (princ)
    A man who never made mistakes never made anything

Similar Threads

  1. Multiple closed polyline areas
    By Bender in forum AutoCAD Beginners' Area
    Replies: 1
    Last Post: 14th Apr 2014, 07:37 pm
  2. Adding the sum of Multiple Areas
    By Wise in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 11
    Last Post: 11th Jun 2010, 07:26 am
  3. How to calculate multiple areas?
    By BenGoble in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 1
    Last Post: 1st Jun 2009, 08:03 pm
  4. How to calculate areas of multiple polylines?
    By xyz001 in forum AutoCAD Drawing Management & Output
    Replies: 4
    Last Post: 13th Feb 2007, 10:24 pm
  5. how do i plot all in black except for shaded areas
    By brentonsavio in forum AutoCAD General
    Replies: 5
    Last Post: 18th Jan 2006, 07:19 pm

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