Author Topic: CAD version without opening the drawing?  (Read 3454 times)

0 Members and 1 Guest are viewing this topic.

thehay95

  • Mosquito
  • Posts: 1
CAD version without opening the drawing?
« on: October 15, 2020, 02:01:57 AM »
Hi,

I'm not new to acad, but I wasn't sure where to put this. I get drawings from
consultants and periodically, I can't open them even after I ask that they save to
the version I use. The question I have is there anyway I can find out exactly
what version they send me without opening the drawing (since I can't)?

sln8458

  • Newt
  • Posts: 91
  • CMS Intellicad 9.0/10.0
Re: CAD version without opening the drawing?
« Reply #1 on: October 15, 2020, 04:13:38 AM »
open the drawing in NOTEPAD, yes it works :)

first line:
Code: [Select]
AC1024       i                                                                                                         h@* ߦ< >$^
G޳MB Z}*$]zD;

then look here:
https://knowledge.autodesk.com/support/autocad/learn-explore/caas/sfdcarticles/sfdcarticles/drawing-version-codes-for-autocad.html

AC1024 - DWG AutoCAD 2010/2011/2012

Steve
There is no such  thing as a 'silly question' to those who do not know!

framednlv

  • Newt
  • Posts: 64
Re: CAD version without opening the drawing?
« Reply #2 on: October 15, 2020, 11:28:31 AM »
JTB World has "Columns for Explorer" (not free) that will show what version the file(s) are.


Lonnie

  • Newt
  • Posts: 166
Re: CAD version without opening the drawing?
« Reply #3 on: October 15, 2020, 09:21:13 PM »
I believe Trueview will not only read it you can save it to an earlier version. Thinking about it I think the runtime version of Microstation will too it runs for 20 min then stops but you can get back into it right away. I use to do whole jobs with it.
« Last Edit: October 15, 2020, 09:25:09 PM by Lonnie »

BIGAL

  • Swamp Rat
  • Posts: 1383
  • 40 + years of using Autocad
Re: CAD version without opening the drawing?
« Reply #4 on: October 20, 2020, 07:02:33 PM »
One thing in lisp is to READ-CHAR so you could read the start of a file and look at the acad???? will have a play.

Had a google

Code: [Select]
(DEFUN rb (/ buffer char fh)
(setq buffer '())
  (SETQ fh (OPEN "d:\\ACADTEMP\\TEST1.dwg"
"r"
   )
n  -1
  )
  (WHILE (< (SETQ n (1+ n)) 6)
    (setq char (chr (READ-CHAR fh)))
    (SETQ buffer (CONS char buffer))
  )
  (IF fh
    (SETQ fh (CLOSE fh))
  )
  (REVERSE buffer)
)
(rb)
« Last Edit: October 20, 2020, 07:21:53 PM by BIGAL »
A man who never made a mistake never made anything

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: CAD version without opening the drawing?
« Reply #5 on: October 20, 2020, 09:27:22 PM »
I'm kinda surprised no one has anted up a pre-rolled solution as just about every CAD manager / support geek has written one.

Anyway, here's one I have in my library:

Code - Auto/Visual Lisp: [Select]
  1. (defun mp-get-dwg-ver ( dwg / handle stream )
  2.  
  3.     ;;  Return the specified drawing's version as a string representing
  4.     ;;  the AutoCAD versions that create and support the version natively,
  5.     ;;  e.g. "2018/2019/2020/2021". Of course drawings saved by Civil3D
  6.     ;;  enjoy a special versioning hell that doesn't precisely follow this
  7.     ;;  schema. Thanks Autodesk.
  8.  
  9.     (cond
  10.         ((null (setq handle (open dwg "r"))) nil) ;; could not open drawing, return nil
  11.         ((progn (setq stream (substr (read-line handle) 1 6))(close handle)))
  12.         ((eq "AC1032" stream) "2018/2019/2020/2021")
  13.         ((eq "AC1027" stream) "2013/2014/2015/2016/2017")
  14.         ((eq "AC1024" stream) "2010/2011/2012")
  15.         ((eq "AC1021" stream) "2007/2008/2009")
  16.         ((eq "AC1018" stream) "2004/2005/2006")
  17.         ((eq "AC1015" stream) "2000/2000I/2002") ;; was 2000i, forced uppercase
  18.         ((eq "AC1014" stream) "R14")
  19.         ((eq "AC1012" stream) "13")
  20.         ((eq "AC1009" stream) "11,12")
  21.         ((eq "AC1006" stream) "10")
  22.         ((eq "AC1004" stream) "9")
  23.         ((eq "AC1003" stream) "2.6")
  24.         ((eq "AC1002" stream) "2.5")
  25.         ((eq "AC2.10" stream) "2.10")
  26.         ((eq "AC1.50" stream) "2.0")
  27.         ((eq "AC1.4" (setq stream (substr stream 1 5))) "1.4")
  28.         ((eq "AC1.2" stream) "1.2")
  29.         ((eq "MC0.0" stream) "1.1")
  30.         ("Doesn't appear to be an AutoCAD dwg, cue sad trombone.")
  31.     )
  32. )

Cheers.

Engineering Technologist CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.com http://cadanalyst.slack.com http://linkedin.com/in/cadanalyst

Keith

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: CAD version without opening the drawing?
« Reply #6 on: October 21, 2020, 02:30:18 AM »
Once upon a time I had a utility that ran in the background that captured the file version and automatically opened it in the correct version so as to prevent users from saving it to a newer file type back when we had several different versions installed. That was 15 years ago .. and sadly, I can no longer find my code repository from back then. I have it, I just don't know where :-/
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Crank

  • Water Moccasin
  • Posts: 1503
Re: CAD version without opening the drawing?
« Reply #7 on: October 21, 2020, 08:12:35 AM »
Here's an idea (Q&D):
Code: [Select]
(defun dwg-ver ( / handle stream OpenSave)
    (vl-load-com)
    (setq OpenSave (vla-get-preferences (vlax-get-acad-object)))
    (cond
        ((null (setq handle (open (strcat (getvar "DWGPREFIX")(getvar "DWGNAME")) "r"))) nil) ;; could not open drawing, return nil
        ((progn (setq stream (substr (read-line handle) 1 6))(close handle)))
        ((eq "AC1032" stream) (vla-put-saveastype (vla-get-opensave OpenSave) "64")); 2018/2019/2020/2021
        ((eq "AC1027" stream) (vla-put-saveastype (vla-get-opensave OpenSave) "60")); 2013/2014/2015/2016/2017
        ((eq "AC1024" stream) (vla-put-saveastype (vla-get-opensave OpenSave) "48")); 2010/2011/2012
        ((eq "AC1021" stream) (vla-put-saveastype (vla-get-opensave OpenSave) "36")); 2007/2008/2009
        ((eq "AC1018" stream) (vla-put-saveastype (vla-get-opensave OpenSave) "24")); 2004/2005/2006
        ((eq "AC1015" stream) (vla-put-saveastype (vla-get-opensave OpenSave) "12")); 2000/2000i/2002
;        ((eq "AC1014" stream) "R14")
;        ((eq "AC1012" stream) "13")
;        ((eq "AC1009" stream) "11,12")
;        ((eq "AC1006" stream) "10")
;        ((eq "AC1004" stream) "9")
;        ((eq "AC1003" stream) "2.6")
;        ((eq "AC1002" stream) "2.5")
;        ((eq "AC2.10" stream) "2.10")
;        ((eq "AC1.50" stream) "2.0")
;        ((eq "AC1.4" (setq stream (substr stream 1 5))) "1.4")
;        ((eq "AC1.2" stream) "1.2")
;        ((eq "MC0.0" stream) "1.1")
        ("Doesn't appear to be an AutoCAD dwg, cue sad trombone.")
    )
)
Vault Professional 2023     +     AEC Collection

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: CAD version without opening the drawing?
« Reply #8 on: October 21, 2020, 08:27:09 AM »
Ummm no. We have clients that have drawings spanning the 80s to now. That said, abuse it as you see fit, indeed all sample code posted to the swamp enjoys that future. Cheers.
Engineering Technologist CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.com http://cadanalyst.slack.com http://linkedin.com/in/cadanalyst

Keith

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: CAD version without opening the drawing?
« Reply #9 on: October 21, 2020, 06:16:28 PM »
Ummm no. We have clients that have drawings spanning the 80s to now. That said, abuse it as you see fit, indeed all sample code posted to the swamp enjoys that future. Cheers.


que

I feel like there is a missing post somewhere before this one
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: CAD version without opening the drawing?
« Reply #10 on: October 21, 2020, 08:09:29 PM »
Ummm no. We have clients that have drawings spanning the 80s to now. That said, abuse it as you see fit, indeed all sample code posted to the swamp enjoys that future. Cheers.


que

I feel like there is a missing post somewhere before this one

What was missing was the bucket of coffee I should have downed before posting this AM.

I completely misread Crank's post.

TLDR: look away, I'm hideous
Engineering Technologist CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.com http://cadanalyst.slack.com http://linkedin.com/in/cadanalyst

Keith

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: CAD version without opening the drawing?
« Reply #11 on: October 21, 2020, 08:23:12 PM »
Haha
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie