.NET

Reply
Active Contributor
bowa
Posts: 45
Registered: ‎03-30-2006
Message 1 of 4 (168 Views)

SaveAs problem in AC2007

168 Views, 3 Replies
05-31-2007 10:58 AM
I'm trying to save my AutoCAD drawing using the SaveAs function in AutoCAD 2007 and VS2005.

In AutoCAD 2006 and VB2003 I used:
strFile = Dwg.FullName.ToString()
Dim acadSaveAsType As Object = Dwg.AcSaveAsType.acR18_dwg
Dwg.SaveAs(strFile, acadSaveAsType, Autodesk.AutoCAD.DatabaseServices.SecurityParameters)

This worked without issue but now I'm getting and error indicating that the SecurityParameters are a type and not an object.

Can anyone tell me what object I should be using?
Distinguished Contributor
NathTay
Posts: 1,691
Registered: ‎12-15-2003
Message 2 of 4 (168 Views)

Re: SaveAs problem in AC2007

05-31-2007 03:52 PM in reply to: bowa
Firstly you are using the ActiveX API not the .NET API.

It should never have worked because as the error indicates you are trying to pass the SecurityParameters type instead of an instance. Given it is an optional value you can leave it out all together.

Dwg.SaveAs(strFile, acR18_dwg)

Regards - Nathan
*Tony Tanzillo
Message 3 of 4 (168 Views)

Re: SaveAs problem in AC2007

05-31-2007 08:35 PM in reply to: bowa
What you show never worked, at least not as it
was posted.

You're confusing a type, with an instance of a
type. You're passing a type as the security params,
not an instance of the type.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2008
Supporting AutoCAD 2000 through 2008
http://www.acadxtabs.com

wrote in message news:5612704@discussion.autodesk.com...
I'm trying to save my AutoCAD drawing using the SaveAs function in AutoCAD 2007 and VS2005.

In AutoCAD 2006 and VB2003 I used:
strFile = Dwg.FullName.ToString()
Dim acadSaveAsType As Object = Dwg.AcSaveAsType.acR18_dwg
Dwg.SaveAs(strFile, acadSaveAsType, Autodesk.AutoCAD.DatabaseServices.SecurityParameters)

This worked without issue but now I'm getting and error indicating that the SecurityParameters are a type and not an object.

Can anyone tell me what object I should be using?
Distinguished Contributor
jbooth
Posts: 223
Registered: ‎02-17-2006
Message 4 of 4 (168 Views)

Re: SaveAs problem in AC2007

06-01-2007 11:53 AM in reply to: bowa
As already stated in previous replies, you are trying to pass a class definition into a function that is expecting an object reference.

You can fix it by creating a new instance of the AcDb.SecurityParameters class and pass that into your saveas function.

However, note that the AcadDocument.SaveAs() function has only one required parameter. The other two are optional.

Calling Dwg.SaveAs(strFile) should work in the general case, as it saves in the current version, and uses the default security parameters.
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.