AECDWGVersion via LISP

AECDWGVersion via LISP

istvan_voiculescu
Enthusiast Enthusiast
1,022 Views
7 Replies
Message 1 of 8

AECDWGVersion via LISP

istvan_voiculescu
Enthusiast
Enthusiast

I know that I can get the dwg version via Lisp and make the user aware of the dwg file version he is opening, but what about the AECDWGVERSION? If I run the AECDWGVERSION command I get an print of this type" This DWG file was last saved by version 8, 0, 53, 0" So If I make a list of all the AEC versions, then I could provide the user feedback on what version of Civil 3D file he opens.

So if I have a user running Civil 3D 2019 and opens a Civil 3D 2017 file, I want the prompt for the user to be aware he is opening that version and that he agrees to go foward with the opening of the file, otherwise close without saving the file. If the user opens a Civil 3D 2019 file, he should be "congratulated" with an OK, you're good to go message. 🙂

ISTVAN “ISHKA” VOICULESCU
CAD/IT Systems Admin Sr.
BIM / CADD MANAGER
CITY OF AUSTIN, PUBLIC WORKS DEPARTMENT
ENGINEERING SERVICES DIVISION
0 Likes
1,023 Views
7 Replies
Replies (7)
Message 2 of 8

andkal
Collaborator
Collaborator

Retrieving numbers contained in "lastprompt" text could be the solution for you.

(setvar "CMDECHO" 1)
(setq A (getvar "lastprompt") )

then using (substr    ) you get numbers and you instruct Autocad what he has to do with them later in your program.


• www.autolisps.blogspot.com - Productivity plugins for Autocad and Autocad MEP
• Autodesk AppStore
Message 3 of 8

ronjonp
Mentor
Mentor

Have you poked around the (namedobjdict) ? Perhaps version info is stored in there. I don't have a drawing to test this theory out on though.

 

See what this spits out:

(mapcar 'print (entget (namedobjdict)))

 

0 Likes
Message 4 of 8

istvan_voiculescu
Enthusiast
Enthusiast

Got something written. Just that I don't know why it does not fire every time I open a file. I know I add it to my acaddoc lsp in a correct way, as I assume.

 

(if (findfile "ESD_AECC3DDVERSION.lsp")(progn (load "ESD_AECC3DDVERSION.lsp")(C:ESDC3DVER)))

So I know it loads with every file, just that it does not produce the expected result when it opens the file, but rather when I manually launch the command once the file is opened.

ISTVAN “ISHKA” VOICULESCU
CAD/IT Systems Admin Sr.
BIM / CADD MANAGER
CITY OF AUSTIN, PUBLIC WORKS DEPARTMENT
ENGINEERING SERVICES DIVISION
0 Likes
Message 5 of 8

dlanorh
Advisor
Advisor

Something like this has been asked before http://www.theswamp.org/index.php?topic=49015.0

 

Try localising your variables

I am not one of the robots you're looking for

0 Likes
Message 6 of 8

istvan_voiculescu
Enthusiast
Enthusiast

I used that for defining what I have attached in the last reply. However, I don't have as much knowledge on LISP other than apply the logic and figure out how things are tied. So with that in mind, I got up to this point, but have no idea how to make it fire the right way when open a file, or if what I am looking can be defined some other way. This is not about DWG version but rather about Object version for Civil 3D objects. With Civil 3D objects being different from year to year, compared to the dwg version that doesn't change for at least 3 years, I need to make the users be aware they are opening a CAD file created with objects in specific year.

ISTVAN “ISHKA” VOICULESCU
CAD/IT Systems Admin Sr.
BIM / CADD MANAGER
CITY OF AUSTIN, PUBLIC WORKS DEPARTMENT
ENGINEERING SERVICES DIVISION
0 Likes
Message 7 of 8

dlanorh
Advisor
Advisor
See my reply at CADTutor

I am not one of the robots you're looking for

0 Likes
Message 8 of 8

tdeleske
Participant
Participant

Kudo's to whoever created ESD_AECC3DDVERSION.lsp. it works great with new versions added.

Thank you!

 

Trevor

0 Likes