Author Topic: DWG separate  (Read 3076 times)

0 Members and 1 Guest are viewing this topic.

tmac

  • Guest
DWG separate
« on: August 21, 2016, 10:42:24 PM »
hello,every master
 
  I have a probelm,for some days.there are many drawings frame in one dwg file,like  this
 
 
20160822102426.png
 
now, the problem is how can i separate every drawing by frame and save it independent DWG files。
 
the function maybe like this :http://through-the-interface.typepad.com/through_the_interface/2010/03/marchs-plugin-of-the-month-live-on-autodesk-labs-batch-publish-for-autocad.html
if you1will do it ,the c# code will be better.
 
thanks......
« Last Edit: August 22, 2016, 02:35:45 AM by tmac »

tmac

  • Guest
Re: DWG separate
« Reply #1 on: August 22, 2016, 09:35:33 AM »
oh,come on ,somebody heip me

ChrisCarlson

  • Guest
Re: DWG separate
« Reply #2 on: August 22, 2016, 09:37:02 AM »
I can't see anything...

can you be more descriptive??

tmac

  • Guest
Re: DWG separate
« Reply #3 on: August 22, 2016, 09:57:57 AM »
http://forums.autodesk.com/t5/net/dwg-separate/m-p/6513577/highlight/false#M49863v


this is the same question,i asked.

do you catch on me?

ChrisCarlson

  • Guest
Re: DWG separate
« Reply #4 on: August 22, 2016, 10:04:42 AM »
Code - Auto/Visual Lisp: [Select]
  1. ;;;
  2. ;;;    LayoutsToDwgs.lsp
  3. ;;;    Created 2000-03-27
  4.  
  5. ;;; By Jimmy Bergmark
  6. ;;; Copyright (C) 1997-2012 JTB World, All Rights Reserved
  7. ;;; Website: www.jtbworld.com
  8. ;;; E-mail: info@jtbworld.com
  9. ;;;
  10. ;;; 2003-12-12 Sets UCS to world in model space
  11. ;;;            to avoid problem with wblock
  12. ;;; 2011-06-06 Excludes empty layouts
  13. ;;; 2012-06-01 Handle Map prompt with WBLOCK
  14. ;;;             Include AutoCAD Map information in the export? [Yes/No] <Y>:
  15. ;;; 2013-03-04 Added _ on some commands to internationalize it
  16. ;;;
  17. ;;;    For AutoCAD 2000, 2000i, 2002, 2004, 2005,
  18. ;;;    2006, 2007, 2008, 2009, 2011, 2012, 2013 and newer
  19. ;;;
  20. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  21. ;;;   Creates separate drawings of all layouts.
  22. ;;;   The new drawings are saved to the current drawings path
  23. ;;;   and overwrites existing drawings.
  24. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  25. (defun c:LayoutsToDwgs (/ errexit undox olderr oldcmdecho fn path
  26.                           msg msg2 fileprefix i j)
  27.  
  28.   (defun errexit (s)
  29.     (princ "\nError:  ")
  30.     (princ s)
  31.     (restore)
  32.   )
  33.  
  34.   (defun undox ()
  35.     (command "._undo" "_E")
  36.     (setvar "cmdecho" oldcmdecho)
  37.     (setq *error* olderr)
  38.     (princ)
  39.   )
  40.  
  41.   (setq olderr  *error*
  42.         restore undox
  43.         *error* errexit
  44.   )
  45.   (setq oldcmdecho (getvar "cmdecho"))
  46.   (setvar "cmdecho" 0)
  47.   (defun DelAllLayouts (Keeper / TabName)
  48.     (vlax-for Layout
  49.                      (vla-get-Layouts
  50.                        (vla-get-activedocument (vlax-get-acad-object))
  51.                      )
  52.       (if
  53.         (and
  54.           (/= (setq TabName (strcase (vla-get-name layout))) "MODEL")
  55.           (/= TabName (strcase Keeper))
  56.         )
  57.          (vla-delete layout)
  58.       )
  59.     )
  60.   )
  61.  
  62.   (setq msg "" msg2 "" i 0 j 0)
  63.   (command "._undo" "_BE")
  64.   (setq fileprefix (getstring "Enter filename prefix: "))
  65.       (progn
  66.         (command "_.undo" "_M")
  67.         (DelAllLayouts lay)
  68.         (setvar "tilemode" 1)
  69.         (command "_.ucs" "_w")
  70.         (setvar "tilemode" 0)
  71.         (setq path (getvar "DWGPREFIX"))
  72.         (setq fn (strcat path fileprefix lay ".dwg"))
  73.         (if (findfile fn)
  74.           (progn
  75.             (command "_.-wblock" fn "_Y")
  76.             (if (equal 1 (logand 1 (getvar "cmdactive")))
  77.               (progn
  78.                 (setq i (1+ i) msg (strcat msg "\n" fn))
  79.                 (command "*")
  80.               )
  81.               (setq j (1+ j) msg2 (strcat msg2 "\n" fn))
  82.             )
  83.           )
  84.           (progn
  85.             (command "_.-wblock" fn "*")
  86.             (setq i (1+ i)  msg (strcat msg "\n" fn))
  87.           )
  88.         )
  89.         (if (equal 1 (logand 1 (getvar "cmdactive")))
  90.           (command "_N")
  91.         )
  92.         (command "_.undo" "_B")
  93.       )
  94.     )
  95.   )
  96.   (if (/= msg "")
  97.     (progn
  98.       (if (= i 1)
  99.         (prompt "\nFollowing drawing was created:")
  100.         (prompt "\nFollowing drawings were created:")
  101.       )
  102.       (prompt msg)
  103.     )
  104.   )
  105.   (if (/= msg2 "")
  106.     (progn
  107.       (if (= j 1)
  108.         (prompt "\nFollowing drawing was NOT created:")
  109.         (prompt "\nFollowing drawings were NOT created:")
  110.       )
  111.       (prompt msg2)
  112.     )
  113.   )
  114.   (command "._undo" "_E")
  115.   (textscr)
  116.   (restore)
  117.   (princ)
  118. )

I know you are asking for .NET but give this a whirl? It's pretty old but rock solid

tmac

  • Guest
Re: DWG separate
« Reply #5 on: August 22, 2016, 10:25:33 AM »
oh,bro,

my function is there are some drawings in one dwg file,maybe like batch plot tool

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: DWG separate
« Reply #6 on: August 22, 2016, 10:31:12 AM »
Want fries with that?

More seriously, the intention of this board is to help people write code, not do it all for them.  You'll get farther if you post what code you've had and point to the parts where you're hitting a roadblock.  If you have no code, if you cannot write code, then I'd recommend finding someone to hire (and no, that's not me).
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

tmac

  • Guest
Re: DWG separate
« Reply #7 on: August 22, 2016, 10:43:53 AM »
lol

bro,i was wrote for some days,

now i can identify the drawing frame,

i mean you can show the important code,not all.

at last,if you like.

so,am i wrong???

n.yuan

  • Bull Frog
  • Posts: 348
Re: DWG separate
« Reply #8 on: August 22, 2016, 10:47:11 AM »
Before you take pains to write code to solve the issue, or spend money to hire someone to do it, you may want to ask the one who create this drawing: is AutoCAD used correctly to generate the drawing? If the drawing is generated correctly, it is likely you do not need write any code to to batch plotting, for example, each frame could be on its own layout, and "Publish" command could be used to plot selected layout or all layout at one shot. writing code against badly created drawing is the last thing you want to do.

Jeff H

  • Needs a day job
  • Posts: 6150
Re: DWG separate
« Reply #9 on: August 22, 2016, 10:54:11 AM »
Before you take pains to write code to solve the issue, or spend money to hire someone to do it, you may want to ask the one who create this drawing: is AutoCAD used correctly to generate the drawing? If the drawing is generated correctly, it is likely you do not need write any code to to batch plotting, for example, each frame could be on its own layout, and "Publish" command could be used to plot selected layout or all layout at one shot. writing code against badly created drawing is the last thing you want to do.
Great point!
I am guilty of doing that and it never ends well.

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: DWG separate
« Reply #10 on: August 22, 2016, 12:21:53 PM »
Before you take pains to write code to solve the issue, or spend money to hire someone to do it, you may want to ask the one who create this drawing: is AutoCAD used correctly to generate the drawing? If the drawing is generated correctly, it is likely you do not need write any code to to batch plotting, for example, each frame could be on its own layout, and "Publish" command could be used to plot selected layout or all layout at one shot. writing code against badly created drawing is the last thing you want to do.
Great point!
I am guilty of doing that and it never ends well.

Hmmm.  As I read it that was "...LIKE batch plot tool..." to describe the operation, rather than specifically requesting that.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

tmac

  • Guest
Re: DWG separate
« Reply #11 on: August 24, 2016, 12:04:42 AM »
at last,I solved it,by myself.thanks everybody

ChrisCarlson

  • Guest
Re: DWG separate
« Reply #12 on: August 24, 2016, 08:02:56 AM »
This thread is worthless if you don't share your solution