Programmatically setting the default file save type.

Programmatically setting the default file save type.

warwick.cope
Explorer Explorer
903 Views
17 Replies
Message 1 of 18

Programmatically setting the default file save type.

warwick.cope
Explorer
Explorer

Hi all,

 

I am writing an external script, more just for the experience than anything else, to alter my profile settings within AutoCAD 2022 Mechanical. I am connecting through COM (this is obviously Windows) and able to access everything just fine. But I am not able to get the default file version to change. I have been using the "SaveAsType" property listed here. I can retrieve an integer (64) that corresponds to my current default file version. But changing the integer, although completes successfully, is never reflected within the options screen in AutoCAD or the "Save" dialog screen.

This got me thinking so I went to see if altering it in LISP gave different results, but it did not.(GetEnv "DefaultFormatForSave") returns 64 (2018 DWG) but (SetEnv "DefaultFormatForSave" "66") should change the type to 2018 DWT, but it does not.

 

After further investigation I found that both my external COM script and changing the environment variable through LISP work in the Vanilla profile, but not in Mechanical.

 

So my question is, is there a way to use the "SaveAsType" property and/or "DefaultFormatForSave" in Mechanical?

0 Likes
904 Views
17 Replies
Replies (17)
Message 2 of 18

john.uhden
Mentor
Mentor

I don't know the answer to that question, except I find it quite rude on Autodesk's part.

Have you tried searching through the registry for those keys?  Perhaps there's a separate entry under Mechanical that you can change while hacking.

John F. Uhden

0 Likes
Message 3 of 18

warwick.cope
Explorer
Explorer

I have searched through the registry and did find Mechanical specific settings. Weirdly, the registry option changes the file type that is selected in the options dialog under the tools button in the save/save as window. And for some reason, changing the file type there, does not update the file type in the attached save/save as window, nor does it change the file type saved in the profile. So that was another dead end unfortunately. 

0 Likes
Message 4 of 18

john.uhden
Mentor
Mentor

@warwick.cope 

I am dismayed to hear the bad news.

I think it's that some of the Autodesk programmers just aren't getting their job done right.

John F. Uhden

Message 5 of 18

pendean
Community Legend
Community Legend
With 92-views so far with very little feedback, I'll ask the dumb question: what is the ultimate goal for you with this ability? You mention "profile" then " file version to change", "options screen" and "save dialog box" plus other good catch phrases 😉

TIA
0 Likes
Message 6 of 18

warwick.cope
Explorer
Explorer
Valid point. No real ultimate goal. I am simply experimenting with the capabilites that Autodesk built into the software. I understand altering profile settings from either outside of AutoCAD or via LISP would rarely, if ever, be done; but Autodesk included the capability for a reason I guess.

At this point, I have exhausted my own knowledge and skills and based on the feedback and was hoping someone with more experience may have some insight. Looking like a bit of a fool's errand however.
0 Likes
Message 7 of 18

john.uhden
Mentor
Mentor

@pendean 

My understanding is that the OP would like to set the default save type to something other than what Mechanical wants, and he can't find any way to do it (without going through the picks on each save or save-as), but he can't change the default.

John F. Uhden

0 Likes
Message 8 of 18

ronjonp
Advisor
Advisor

This is a hard one to troubleshoot without the software. It's strange that in Mechanical the setvars don't work the same as in vanilla.

0 Likes
Message 9 of 18

john.uhden
Mentor
Mentor

@ronjonp 

No offense meant to anyone in particular (that I could mention) but MEs are strange.  They wanted to budget 200 man-hours to draw and label 500 feet of water service with two bends and a tee connection.  They wanted to hang 10" steam and cold return lines from a piece of sheet metal, and then say "Oh, they'll figure it out" meaning the contractor.  In the first example, we obviously didn't win the bid.  In the second, I had to take over the job, find a structural buddy, and finish the plans myself.  AARGH!

John F. Uhden

Message 10 of 18

warwick.cope
Explorer
Explorer
This does seem to be the crux of the issue. Although I don't see it as critical. Just a mild curiosity I found while experimenting with code.
0 Likes
Message 11 of 18

pendean
Community Legend
Community Legend
@ronjonp if you are a current AutoCAD subscriber, then MECH is a free install/download for you to use as you wish for the duration of your subscription https://www.autodesk.com/products/autocad/included-toolsets/autocad-mechanical

0 Likes
Message 12 of 18

john.uhden
Mentor
Mentor

@pendean ,

@ronjonp is also an Expert Elite, so he can get whatever he wants.

John F. Uhden

0 Likes
Message 13 of 18

pendean
Community Legend
Community Legend
@john.uhden Just replying to the concern posted about lack of access to MECH: even EEs need guidance occasionally like we all do 😉
0 Likes
Message 14 of 18

john.uhden
Mentor
Mentor

@pendean 

As an electrical friend once told me, you can't spell GEEK without a double-E.

John F. Uhden

0 Likes
Message 15 of 18

pendean
Community Legend
Community Legend
😉
0 Likes
Message 16 of 18

ronjonp
Advisor
Advisor

@pendean Ah yes! I forgot about that.

@john.uhden Indeed, a proud gEEk. 🤓

 

Cheers!

0 Likes
Message 17 of 18

john.uhden
Mentor
Mentor

@ronjonp 

Oh, no!  WATT's that you say?  You're always AMPed up to code?  You find civils reVOLTing?

And I had thought you were a normal person.

Looks can be deceiving.  👽

John F. Uhden

0 Likes
Message 18 of 18

ronjonp
Advisor
Advisor

@john.uhden wrote:

@ronjonp 

Oh, no!  WATT's that you say?  You're always AMPed up to code?  You find civils reVOLTing?

And I had thought you were a normal person.

Looks can be deceiving.  👽


Oh I'm far from 'normal' ! 😂

0 Likes