use this to batch convert 2005 drawings to A2000 format

Discussion in 'AutoCAD' started by James Maeding, Oct 15, 2004.

  1. Ok, I figured out how to deal with the shifting -AecObjExplode prompts.
    I think Autodesk gave this way to little thought, dissapointing...

    This lisp will allow you to explode drawings and convert to A2000 format.
    Then you can use any scripter program to run it on lots of drawings.
    It took me several days of thinking and playing around to figure this out, so don't pass it by if you are converting
    drawings regularly.
    I could compact the code some, but I needed to test individual pieces.

    The command is CNV2000.
    make sure your acad session has access to the -AecObjExplode command, just type it to see.
    It worked for me in LDT and Map....you might need the object enablers for vanilla 2005.

    Here it be:

    ;LISP TO EXPLODE AEC OBJECTS AND CONVERT DRAWING TO 2000
    (DEFUN C:CNV2000 ( / FN HAS-EXPBLKS HAS-PS HAS-XREFS)
    (IF (AND (FINDFILE "aecobjexplode45.arx")(NOT (MEMBER "aecobjexplode45.arx" (ARX))))
    (ARXLOAD "aecobjexplode45.arx")
    )
    ;FIGURE CONDITIONS
    (IF (ANY-PS-ITEMS) (SETQ HAS-PS 1)(SETQ HAS-PS NIL))
    (IF (ANY-LOADED-XREFS) (SETQ HAS-XREFS 1)(SETQ HAS-XREFS NIL))
    (IF (ANY-EXPLODE-BLKS) (SETQ HAS-EXPBLKS 1)(SETQ HAS-EXPBLKS NIL))
    (COND
    ((AND HAS-PS HAS-XREFS HAS-EXPBLKS)
    (command "-AecObjExplode" "y" "all" "n" "y" "n" "y" "n" "y" "n" "y" "y")
    )
    ((AND HAS-PS (NOT HAS-XREFS) HAS-EXPBLKS)
    (command "-AecObjExplode" "y" "all" "n" "y" "y" "n" "y" "n" "y")
    )
    ((AND (NOT HAS-PS) HAS-XREFS HAS-EXPBLKS)
    (command "-AecObjExplode" "y" "n" "y" "n" "y" "n" "y" "y")
    )
    ((AND (NOT HAS-PS) (NOT HAS-XREFS) HAS-EXPBLKS)
    (command "-AecObjExplode" "y" "y" "n" "y" "n" "y")
    )
    ((AND HAS-PS HAS-XREFS (NOT HAS-EXPBLKS))
    (command "-AecObjExplode" "y" "all" "n" "n" "y" "n" "y" "n" "y" "y")
    )
    ((AND HAS-PS (NOT HAS-XREFS) (NOT HAS-EXPBLKS))
    (command "-AecObjExplode" "y" "all" "n" "y" "n" "y" "n" "y")
    )
    ((AND (NOT HAS-PS) HAS-XREFS (NOT HAS-EXPBLKS))
    (command "-AecObjExplode" "y" "n" "y" "n" "y" "n" "y" "y")
    )
    ((AND (NOT HAS-PS) (NOT HAS-XREFS) (NOT HAS-EXPBLKS))
    (command "-AecObjExplode" "y" "y" "n" "y" "n" "y")
    )
    )
    ;saveas
    (SETQ FN (strcat (getvar "dwgprefix")(vl-filename-base (getvar "dwgname")) " (2000).dwg"))
    (if (FINDFILE FN)
    (command "saveas" "2000" FN "y")
    (command "saveas" "2000" FN)
    )
    (PRINC)
    )

    (DEFUN ANY-LOADED-XREFS ( / SS XREF-LIST)
    (WHILE (SETQ SS (TBLNEXT "BLOCK" (NULL SS)))
    (IF (AND (EQ 4 (LOGAND 4 (CDR (ASSOC 70 SS)))) ;SEE IF 4 FLAG IS SET (3RD BIT)
    (EQ 32 (LOGAND 32 (CDR (ASSOC 70 SS))))
    )
    (SETQ XREF-LIST (CONS (CDR (ASSOC 2 SS)) XREF-LIST))
    )
    )
    XREF-LIST
    )

    (DEFUN ANY-EXPLODE-BLKS ( / SS BLK-LIST)
    (WHILE (SETQ SS (TBLNEXT "BLOCK" (NULL SS)))
    (IF (WCMATCH (STRCASE (CDR (ASSOC 2 SS))) "AECOBJEXPLODE*")
    (SETQ BLK-LIST (CONS (CDR (ASSOC 2 SS)) BLK-LIST))
    )
    )
    BLK-LIST
    )

    (DEFUN ANY-PS-ITEMS ( / LAYOUT NAME SS RET)
    ;LOOP THROUGH LAYOUTS
    ;(VLA-GET-COUNT (VLA-GET-PAPERSPACE (VLA-GET-ACTIVEDOCUMENT (VLAX-GET-ACAD-OBJECT))))
    (VLAX-FOR LAYOUT (VLA-GET-LAYOUTS (VLA-GET-ACTIVEDOCUMENT (VLAX-GET-ACAD-OBJECT)))
    (IF (AND
    (/= (SETQ NAME (VLA-GET-NAME LAYOUT)) "Model")
    (SETQ SS (SSGET "x" (LIST (CONS 410 NAME))))
    (> (SSLENGTH SS) 1)
    ;IF ONE IS VP AND ONE IS ZZ BLOCK...
    (NOT (AND (= (SSLENGTH SS) 2)
    ;(OR (SSGET "x" (LIST (CONS 410 NAME)(CONS 2 "PROJ_NAM")))
    (SSGET "x" (LIST (CONS 410 NAME)(CONS 2 "ADCADD_ZZ")))
    ;)
    )
    )
    )
    (SETQ RET 1)
    )
    )
    RET
    )
    James Maeding
    jmaeding at hunsaker dot com
    Civil Engineer/Programmer
     
    James Maeding, Oct 15, 2004
    #1
  2. wow, no replies yet....
    there have to be some takers out there

    James Maeding <>


    James Maeding
    jmaeding at hunsaker dot com
    Civil Engineer/Programmer
     
    James Maeding, Oct 15, 2004
    #2
  3. James Maeding

    C Witt Guest

    what is wrong with using the batch drawing converter?
     
    C Witt, Oct 15, 2004
    #3
  4. aaahhhhh, some interest.

    What Autodesk does not tell you is that the BDC does not convert drawings correctly that have objects from LDT and
    probably ADT in them. Now the fun part is you cannot tell ahead of time if the objects are in the drawings. So you
    have to assume they are.

    So the only correct ways of converting the drawings are:
    1) use the Export to Acad command in the LDT File pulldown
    2) Use Etransmit with the "Convert with exploded AEC objects" option
    3) Use the -AecObjExplode command then do the saveas by hand

    Item 2 is out as the etransmit will not do many things needed, the list is about 6 long currently
    Item 1 is ugly to script because you have to round trip your drawings through LDT2005 to do it.
    Item 3 is nice because it can be scripted to run in any Map or LDT session.

    Problem was the -AecObjExplode command is tricky to run, it requires the lisp I did.

    Now all of this is rediculous if you ask me,
    Autodesk should have, and SHOULD STILL modify the batch drawing converter to convert the objects automatically.
    Why in the world would we not want them exploded? They screw up earlier versions of acad.
    Now I dont knwo what you call this but I call it a defect. I would bet money this is a direct effect of Adesk shoving
    releases out every year. They made the Etransmit work, it is obvious they thought that was good enough and stopped.

    I forgive easily, I would be more than happy to have this defect fixed at any time soon, even though it should have been
    done with the release of LDT2005. I want people to like 2005 since I am moving our office to it. Everyone wins if this
    gets fixed.
    I am working with Autodesk to fix this so please lobby with me for this to be fixed whenever you can.
    thanks

    C Witt <cwitt_AT_trkeng.com>
    |>what is wrong with using the batch drawing converter?

    James Maeding
    jmaeding at hunsaker dot com
    Civil Engineer/Programmer
     
    James Maeding, Oct 15, 2004
    #4
  5. James Maeding

    John Uhden Guest

    James:

    Responding without testing... but do Contours and Points and Grading Objects
    retain their intelligence?




    don't pass it by if you are converting
     
    John Uhden, Oct 16, 2004
    #5
  6. Hi John,
    I would guess no. I hate to rip on Autodesk on this subject, but they really dropped the ball in my opinion.
    How could they introduce new objects to LDT and then not make them convert back when a saveas was done?
    I am thinking they at least could have made the objects explode, then if the right stuff is available (LDT..) convert
    them back to objects that work in A2002.
    I seem to remember you having something to do this.
    Hey, are you starting to adapt your routines to Civil 3D yet? I'm sure you are beta testing...

    "John Uhden" <>
    |>James:
    |>
    |>Responding without testing... but do Contours and Points and Grading Objects
    |>retain their intelligence?

    James Maeding
    jmaeding at hunsaker dot com
    Civil Engineer/Programmer
     
    James Maeding, Oct 18, 2004
    #6
  7. James Maeding

    John Uhden Guest

    Hi, James.

    Yeah, I've got a little PUSH2K thingy to save back. Haven't had time to "adapt"
    to 3D, but it's gotta be coming soon.




    dropped the ball in my opinion.
    right stuff is available (LDT..) convert
     
    John Uhden, Oct 19, 2004
    #7
  8. oh, by the way, If you ever write a lisp to loop through the pvi's in a FG or any vertical alignment, make sure you
    release the pvi object at the end of the loop (within the loop, not after the loop).
    This has plagued me for months and I just realized it.
    You would think you only need to release stuff at the end of a subroutine, but I am finding you have to do it when
    objects get reused like within a loop that reuses a PVI variable over and over....

    "John Uhden" <>
    |>Hi, James.
    |>
    |>Yeah, I've got a little PUSH2K thingy to save back. Haven't had time to "adapt"
    |>to 3D, but it's gotta be coming soon.

    James Maeding
    jmaeding at hunsaker dot com
    Civil Engineer/Programmer
     
    James Maeding, Oct 19, 2004
    #8
  9. I've been through this.
    On the subject, you might want to look at:
    http://www.jtbworld.com/lisp/AecExportToAutoCAD.htm
    http://www.jtbworld.com/lisp/AECObjectsExplodeOptions.htm

    --
    Best Regards, Jimmy Bergmark
    CAD and Database Developer Manager at www.pharmadule-emtunga.com
    Take a look at
    JTB FlexReport (FLEXlm report tool) - www.jtbworld.com/jtbflexreport
    SmartPurger (Purges automatically) - www.jtbworld.com/?/smartpurger.htm
    or download some freeware at www.jtbworld.com
    More on AutoCAD 2005;
    www.jtbworld.com/autocad2005.htm
     
    Jimmy Bergmark, Oct 19, 2004
    #9
  10. James Maeding

    John Uhden Guest

    Thanks, James, for the heads up. What I recently discovered was that using the
    'PerpIntersection method may not work with a "jagged" alignment.




    any vertical alignment, make sure you
    I am finding you have to do it when
     
    John Uhden, Oct 21, 2004
    #10
  11. Thanks Jimmy,
    I see what you are doing, taking the settings from one spot to another so the dialog is not the only way to set things
    up. That is fine, but is different than what my lisp is for.
    If you want to run a convert on a bunch of drawings, dialogs are no good. So the next step is ofcourse the command line
    method.
    Well, even if you want the exact same settings each time (which I do), the command line AECObjectExplode behaves
    differently depending on the drawing. You need a lisp to detect the various properties of the drawing and issue the
    right command prompts.

    Look at the lisp and you will see its not just a matter of feeding in the same number of params each time. Makes you
    wonder what Adesk was thinking - why do a command line version if it was difficult to use in scripts.
    Autodesk has performed poorly on this one, I have chased them and they refuse to allocate resources to fix the Batch
    drawing converter so we dont need some slow second hand lisp way...

    "Jimmy Bergmark" <>
    |>I've been through this.
    |>On the subject, you might want to look at:
    |>http://www.jtbworld.com/lisp/AecExportToAutoCAD.htm
    |>http://www.jtbworld.com/lisp/AECObjectsExplodeOptions.htm

    James Maeding
    jmaeding at hunsaker dot com
    Civil Engineer/Programmer
     
    James Maeding, Nov 1, 2004
    #11
  12. Jimmy Bergmark, Nov 3, 2004
    #12
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.