Author Topic: Which AEC Version is it?  (Read 4690 times)

0 Members and 1 Guest are viewing this topic.

cadman6735

  • Guest
Which AEC Version is it?
« on: September 13, 2012, 12:13:45 PM »
I have done a quick search and have found that I can tell which version of AutoCAD I currently have open, I have found I can find which version a .dwg was last saved to.  (meaning that it matters not that I am in 2013 if I save down to 2000 this is what I get back, 2000, not that the file was created or upgraded to 2013)

Is there a way to tell which version an AEC object is?  AutoDesk changes every 3 years.  2013 is not compatable with 2012, this is the change year and we have encounted ourselves a situation where I need to know if a file is 2012 AEC or 2013 AEC without manualy opening each file.

Thanks for any advice.

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Which AEC Version is it?
« Reply #1 on: September 13, 2012, 12:25:30 PM »
Presumably the version of an AEC object must be less than or equal to the drawing file version, so could this be ascertained by reading the drawing file header?

Example:
Code - Auto/Visual Lisp: [Select]
  1. ;; Get Version  -  Lee Mac
  2. (defun c:getversion ( / f v )
  3.     (if
  4.         (and
  5.             (setq f (open (strcat (getvar 'dwgprefix) (getvar 'dwgname)) "r"))
  6.             (setq v
  7.                 (cdr
  8.                     (assoc (strcase (substr (read-line f) 1 6))
  9.                        '(
  10.                             ("AC1024" . "2010-2012")
  11.                             ("AC1021" . "2007-2009")
  12.                             ("AC1018" . "2004-2006")
  13.                             ("AC1015" . "2000-2002")
  14.                             ("AC1014" . "Release 14")
  15.                             ("AC1012" . "Release 13")
  16.                             ("AC1009" . "Release 11/12")
  17.                             ("AC1006" . "Release 10")
  18.                             ("AC1004" . "Release 9")
  19.                             ("AC1003" . "Release 2.60")
  20.                             ("AC1002" . "Release 2.50")
  21.                             ("AC1001" . "Release 2.22")
  22.                             ("AC2.22" . "Release 2.22")
  23.                             ("AC2.21" . "Release 2.21")
  24.                             ("AC2.10" . "Release 2.10")
  25.                             ("AC1.50" . "Release 2.05")
  26.                             ("AC1.40" . "Release 1.40")
  27.                             ("AC1.2"  . "Release 1.2")
  28.                             ("MC0.0"  . "Release 1.0")
  29.                         )
  30.                     )
  31.                 )
  32.             )
  33.         )
  34.         (princ (strcat "\nThis is an AutoCAD " v " format file."))
  35.         (princ "\nThe format of this file could not be determined.")
  36.     )
  37.     (if f (close f))
  38.     (princ)
  39. )

cadman6735

  • Guest
Re: Which AEC Version is it?
« Reply #2 on: September 13, 2012, 01:01:16 PM »
Hi lee
Thanks for such a quick reply.

I tested your code in both a 2012 and 2013 and both tell me "The format of this file could not be determined"...
When I command line (getvar 'dwgprefix) it takes me to "C:\\Users\\awclarke\\Documents\\" and the (getvar 'dwgname) give me "Drawing2.dwg"


It seems that these varables would only give me the current version I have open.  Am I missing something or not understanding something correctly?

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Which AEC Version is it?
« Reply #3 on: September 13, 2012, 01:11:46 PM »
Of course, in my example I use the filename of the active drawing to test, but this could be substituted with any drawing filename, open or unopen in the AutoCAD Editor - the point of the code was the method by which I determine the version, I presumed you would have taken the step to apply this method to your particular application.

BlackBox

  • King Gator
  • Posts: 3770
Re: Which AEC Version is it?
« Reply #4 on: September 13, 2012, 01:14:23 PM »
If I might add to the discussion....

I believe Lee is attempting to determine the AEC version by reading the header code that you will see, were you to open any DWG using a text editor (i.e., Notepad, Notepad++, etc.)... Look at the first six characters of the first line.

In any event, I suspect that this method will not be the correct solution, only as a result of verticals supporting both the SaveAs, and Export to AutoCAD methods... Unless I am mistaken, were one to open a Civil 3D 2013 drawing (for example), create an Alignment, then SaveAs 2010 file format, the Alignment (in this case an AECC Object) is still in 2013 format, despite the drawing being opened in 2010, 2011, or 2012.

** Edit - Only when using the Export to AutoCAD command does the AECC Object (the Alignment) get converted to 2010 format. This is a flaw, IMO, for verticals such as Civil 3D.

Perhaps someone more knowledgeable with AEC (not AECC) can clarify?
"How we think determines what we do, and what we do determines what we get."

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Which AEC Version is it?
« Reply #5 on: September 13, 2012, 01:15:55 PM »
Unless I am mistaken, were one to open a Civil 3D 2013 drawing (for example), create an Alignment, then SaveAs 2010 file format, the Alignment (in this case an AECC Object) is still in 2013 format, despite the drawing being opened in 2010, 2011, or 2012.

I feared that may be the case - hence my 'presumption'  :-(

BlackBox

  • King Gator
  • Posts: 3770
Re: Which AEC Version is it?
« Reply #6 on: September 13, 2012, 01:25:53 PM »
Unless I am mistaken, were one to open a Civil 3D 2013 drawing (for example), create an Alignment, then SaveAs 2010 file format, the Alignment (in this case an AECC Object) is still in 2013 format, despite the drawing being opened in 2010, 2011, or 2012.

I feared that may be the case - hence my 'presumption'  :-(

No, your theory is solid, with regard to logic, and common sense.  :wink:

Only as a result of a gap in vertical command procedure (thank you for another shortcoming, Autodesk  :roll:) would your offering not correctly answer this question.

In all seriousness... Who wants to SaveAs a newer Civil 3D drawing as an older format, and _not_ automagically convert the AECC Objects contained within (obviously not the Data Referenced AECC Objects, those should be done separately)...!? The resultant file is not fully useable (in the older version), depending on the task to be performed.

Even within the same Database (read File) format, one cannot successfully Save a drawing (say in Civil 3D 2012), and reopen in an older version (say 2010), even though they are the same file format... It's dumbfounding, really.  :-o

In any event, Cheers, Lee! :beer:
"How we think determines what we do, and what we do determines what we get."

cadman6735

  • Guest
Re: Which AEC Version is it?
« Reply #7 on: September 13, 2012, 01:57:17 PM »
Quote
Of course, in my example I use the filename of the active drawing to test, but this could be substituted with any drawing filename, open or unopen in the AutoCAD Editor - the point of the code was the method by which I determine the version, I presumed you would have taken the step to apply this method to your particular application.

Yes, I recognized that your example code is only for the ative drawing and I was expecting it to tell me if my active drawing was 2012 by returning (This is an AutoCAD 2010-2012 format file.) when in AutoCAD 2012

or returning

(The format of this file could not be determined.) when in a 2013 file.  but it gives me the latter for both versions, 2012 & 2013

Please do not feel me to be lazy, I only didn't understand how accessing the 'dwgprefix or the 'dwgname would tell me about the AEC version.  As mentioned in my OP if I have an AutoCAD ACA file in 2013 and back save it to 2000 when I look at the first six characters it gives me the 2000 version which (I assume) has nothing to do with the AEC version, AEC objects become proxy graphics at this stage.  What I failed to menstion was that knew about the notepad 6 character thing and this is how I knew about what version it was last saved in my OP.

Sorry for the misdirection if I caused any.

Thank you both for you advise

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: Which AEC Version is it?
« Reply #8 on: September 13, 2012, 02:06:09 PM »
Very wild guess, but try checking the Named Object Dictionary for vertical dictionaries.  For vertical content to be supported, I think there needs to be data for them in that location.  If you're really lucky there may be some version information, or at least the type of objects/data that will be found in the drawing.
If you are going to fly by the seat of your pants, expect friction burns.

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

BlackBox

  • King Gator
  • Posts: 3770
Re: Which AEC Version is it?
« Reply #9 on: September 13, 2012, 02:25:05 PM »
Looks to be promising... From Civil 3D 2011, Drawing1:

Code - Auto/Visual Lisp: [Select]
  1.  
  2. (-1 . <Entity name: 7ffffa038c0>)
  3. (0 . "DICTIONARY")
  4. (3 . "ACAD_BACKGROUND")
  5. (3 . "ACAD_COLOR")
  6. (3 . "ACAD_GROUP")
  7. (3 . "ACAD_IMAGE_DICT")
  8. (3 . "ACAD_LAYOUT")
  9. (3 . "ACAD_MATERIAL")
  10. (3 . "ACAD_MLEADERSTYLE")
  11. (3 . "ACAD_MLINESTYLE")
  12. (3 . "ACAD_PLOTSETTINGS")
  13. (3 . "ACAD_PLOTSTYLENAME")
  14. (3 . "ACAD_SCALELIST")
  15. (3 . "ACAD_TABLESTYLE")
  16. (3 . "ACAD_VISUALSTYLE")
  17. (3 . "AcDbVariableDictionary")
  18. (3 . "ADE_QUERY_LIBRARY")
  19. (3 . "AEC_CLASSIFICATION_SYSTEM_DEFS")
  20. (3 . "AEC_DISP_REP_CONFIGURATIONS")
  21. (3 . "AEC_DISP_REP_SETS")
  22. (3 . "AEC_DISP_REPS")
  23. (3 . "AEC_DISPLAY_PROPS_DEFAULTS")
  24. (3 . "AEC_LAYERKEY_STYLES")
  25. (3 . "AEC_MVBLOCK_DEFS")
  26. (3 . "AEC_PROPERTY_SET_DEFS")
  27. (3 . "AEC_VARS")
  28. (3 . "AECC_NETWORK_PART_DEFS")
  29. (3 . "ASE_INDEX_DICTIONARY")
  30. (3 . "Autodesk_MAP")
  31. (3 . "Root")
  32. (3 . "{24DE2741-47F6-4298-B91B-737E814BAE3E}")
  33. (5 . "C")
  34. (100 . "AcDbDictionary")
  35. (280 . 0)
  36. (281 . 1)
  37. (330 . <Entity name: 0>)
  38. (350 . <Entity name: 7ffffa0bb60>)
  39. (350 . <Entity name: 7ffffa03c30>)
  40. (350 . <Entity name: 7ffffa038d0>)
  41. (350 . <Entity name: 7ffffaaf6e0>)
  42. (350 . <Entity name: 7ffffa039a0>)
  43. (350 . <Entity name: 7ffffa03c20>)
  44. (350 . <Entity name: 7ffffa0cc10>)
  45. (350 . <Entity name: 7ffffa03970>)
  46. (350 . <Entity name: 7ffffa03990>)
  47. (350 . <Entity name: 7ffffa038e0>)
  48. (350 . <Entity name: 7ffffa0cb50>)
  49. (350 . <Entity name: 7ffffa03ce0>)
  50. (350 . <Entity name: 7ffffa064e0>)
  51. (350 . <Entity name: 7ffffa03b60>)
  52. (350 . <Entity name: 7ffffa25d00>)
  53. (350 . <Entity name: 7ffffa06450>)
  54. (350 . <Entity name: 7ffffa0b090>)
  55. (350 . <Entity name: 7ffffa0ba20>)
  56. (350 . <Entity name: 7ffffa0b0b0>)
  57. (350 . <Entity name: 7ffffa0b0d0>)
  58. (350 . <Entity name: 7ffffaa4b60>)
  59. (350 . <Entity name: 7ffffa0b080>)
  60. (350 . <Entity name: 7ffffa06460>)
  61. (350 . <Entity name: 7ffffa03d50>)
  62. (350 . <Entity name: 7ffffa0c090>)
  63. (350 . <Entity name: 7ffffa2c830>)
  64. (350 . <Entity name: 7ffffa25d20>)
  65. (350 . <Entity name: 7ffffa03d30>)
  66. (350 . <Entity name: 7ffffa24880>)
  67.  

... Admittedly I am not adept at navigating the dictionaries. Perhaps someone can point me towards a crash course, in an effort of helping the OP?  :angel:
"How we think determines what we do, and what we do determines what we get."

owenwengerd

  • Bull Frog
  • Posts: 451
Re: Which AEC Version is it?
« Reply #10 on: September 13, 2012, 03:23:13 PM »
The ArxDbg utility is very useful for spelunking through dictionaries and inspecting their contents.

cadman6735

  • Guest
Re: Which AEC Version is it?
« Reply #11 on: September 13, 2012, 03:41:21 PM »
Well I have managed to get this far
Code: [Select]
(defun subdict ( dict / aecObj)

  ;(setq mainDict (entget (namedobjdict)))

  (setq aecObj (dictsearch (namedobjdict) dict))

  (textpage)

  (terpri)

  (mapcar 'print aecObj)


(princ)
)

(subdict "AEC_CLASSIFICATION_SYSTEM_DEFS")

I have looked at all the AEC_#### but nothing that tells me version.  Is there way to go deeper on some of these dotted pairs? Just out of curiosity?


Thanks for the link Owen, my autoCAD command line will show the arxdb command but when I select it, AutoCAD tell me "unknown command"  I will investicate this more.

Thanks Renderman for your interest in helping me, I too would be very interested in learning more about dictionary navigation.

BlackBox

  • King Gator
  • Posts: 3770
Re: Which AEC Version is it?
« Reply #12 on: September 13, 2012, 03:42:39 PM »
The ArxDbg utility is very useful for spelunking through dictionaries and inspecting their contents.

Simply fantastic, Owen... This has been installed on my system (for multiple ObjectARX SDK versions), and I never knew it was there. I really must read your site more often!

** Edit - Oh!, and thank you for compiling for each version, as well.

This has just been added to our 'admin' user customizations. Thank you, thank you! :beer:



Obviously, I am very new to this utility, however a quick scan would suggest that the 'Birth DWG Version' for the applicable Dictionary may be a good starting point (unless I am mistaken).
"How we think determines what we do, and what we do determines what we get."

kojacek

  • Mosquito
  • Posts: 14
Re: Which AEC Version is it?
« Reply #13 on: September 14, 2012, 04:36:12 AM »
The ArxDbg utility is very useful for spelunking through dictionaries and inspecting their contents.
For ArxDbx I made a short commands starter by lisp. Command DBV is alternative for context menu:
Code - Auto/Visual Lisp: [Select]
  1. ; =========================================================================================== ;
  2. ;;; arxdbg.lsp  (by kojacek 2010)                                                             ;
  3. ;;; Command starter for arxdbg.arx                                                            ;
  4. ;;;                                                                                           ;
  5. ;;; put: (autoload "arxdbg" '("DBV")) in your *.mnl file                                      ;
  6. ; =========================================================================================== ;
  7. (defun C:DBV ()(jk:ARX_ArxdbgDialog *jk-arxdbgCommands)(princ))
  8. ; =========================================================================================== ;
  9. (defun jk:ARX_ArxdbgDialog (cmdlist / dc fl act tmp)
  10.   (cond
  11.     ( (not
  12.         (and
  13.           (setq fl
  14.             (open
  15.               (setq tmp (vl-filename-mktemp nil nil ".dcl"))
  16.               "w"
  17.             )
  18.           )
  19.           (write-line
  20.             (strcat
  21.               "arxdbgdialog:dialog{key=\"title\";:list_box"
  22.               "{key=\"cmd\";width=35;label=\"Select Command:\""
  23.               ";fixed_width=true;height=20;fixed_height=true;"
  24.               "allow_accept=true;}ok_cancel;}"
  25.             )
  26.             fl
  27.           )
  28.           (not (close fl))
  29.           (< 0 (setq dc (load_dialog tmp)))
  30.           (new_dialog "arxdbgdialog" dc)
  31.         )
  32.       )
  33.     )
  34.     (T
  35.       (set_tile "title" *jk-arxdbgfile)
  36.       (start_list "cmd")
  37.       (mapcar 'add_list cmdlist)
  38.       (end_list)
  39.       (set_tile "cmd" (setq act "0"))
  40.       (action_tile "cmd" "(setq act $value)")
  41.       (if
  42.         (= 1 (start_dialog))
  43.         (progn
  44.           (command
  45.             (nth (atoi act) cmdlist)
  46.           )
  47.           (princ)
  48.         )
  49.       )
  50.     )
  51.   )
  52.   (if (< 0 dc) (unload_dialog dc))
  53.   (if (setq tmp (findfile tmp))(vl-file-delete tmp))
  54.   (princ)
  55. )
  56. ; =========================================================================================== ;
  57.   (setq *jk-arxdbgfile
  58.     (cdr
  59.       (assoc
  60.         (atof (getvar "ACADVER"))
  61.         (if
  62.           (wcmatch (strcase (getenv "PROCESSOR_ARCHITECTURE"))  "*64*")
  63.           (list
  64.             '(17.1 . "arxdbg.2008.x64.arx") ; 2008 x64
  65.             '(17.2 . "arxdbg.2008.x64.arx") ; 2009 x64
  66.             '(18.0 . "arxdbg.2010.x64.arx") ; 2010 x64
  67.             '(19.0 . "arxdbg.2013.x64.arx") ; 2013 x64
  68.           )
  69.           (list
  70.             '(15.0 . "arxdbg.2000.arx")  ; 2000
  71.             '(15.6 . "arxdbg.2000.arx")  ; 2002
  72.             '(16.0 . "arxdbg.2004.arx")  ; 2004
  73.             '(16.1 . "arxdbg.2004.arx")  ; 2005
  74.             '(17.0 . "arxdbg.2007.arx")  ; 2007
  75.             '(17.1 . "arxdbg.2007.arx")  ; 2008
  76.             '(17.2 . "arxdbg.2010.arx")  ; 2009
  77.             '(18.0 . "arxdbg.2010.arx")  ; 2010
  78.             '(19.0 . "arxdbg.2013.arx")  ; 2013
  79.           )
  80.         )
  81.       )
  82.     )
  83.   )
  84.   (if
  85.     (/= "U"
  86.       (setq *jk-arxdbgfileloaded
  87.         (if
  88.           (or
  89.             (not
  90.               (member *jk-arxdbgfile (arx))
  91.             )
  92.             (findfile *jk-arxdbgfile)
  93.           )
  94.           (arxload *jk-arxdbgfile "U")
  95.           *jk-arxdbgfile
  96.         )
  97.       )
  98.     )
  99.     (progn
  100.       (setq *jk-arxdbgCommands
  101.         (list
  102.           "ArxDbgAbout" "AdeskLogo" "AdeskLogoAdd" "AdeskLogoHardwire1"
  103.           "AdeskLogoHardwire2" "AdeskLogoModify" "AdeskLogoStyle"
  104.           "AdeskLogoStyleAdd" "AdeskLogoStyleModify" "MapTestExport"
  105.           "MapTestImport" "Reactors" "Snoop" "SnoopDb" "SnoopEd" "SnoopEnts"
  106.           "SnoopNents" "SnoopServices" "SnoopSysRegistry" "TestColor"
  107.           "TestCountHardRefs" "TestCurve" "TestDwgFiler" "TestEntMake"
  108.           "TestExtDictAdd" "TextExtDictRemove" "TestExtents" "TestGetGripPoints"
  109.           "TestGetOsnapPoints" "TestGetStretchPoints" "TestIntersect"
  110.           "TestPurge" "TestSelSet" "TestState" "TestTblMake" "TestTransDbClones"
  111.           "TestWblockCloneObjects" "TestWorldDraw" "TestXdata" "TestXform"
  112.         )
  113.       )
  114.       (princ (strcat "\nFile: " *jk-arxdbgfile " loaded. Type DBV to use"))
  115.     )
  116.     (princ (strcat "\n*** Error. Can't " *jk-arxdbgfile ". "))
  117.   )
  118.   (princ)
  119. )
  120. ; =========================================================================================== ;
:) kojacek

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Which AEC Version is it?
« Reply #14 on: September 14, 2012, 08:44:48 AM »
@kojacek: Just asking a silly question about your lisp. Not that it's wrong or any such, I'm just curious.

Why do you use the not for checking if the dialog-file has been opened, and then the "else" portion of cond to actually set it up?

IMO you can do the full thing by simply removing the not, and placing the setup into the condition's expressions form. This should make your code a few lines less - not much ... but ... well ...  :|

Otherwise: nice code!
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.