.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Writing summaryInfo inside web service

3 REPLIES 3
Reply
Message 1 of 4
henkvanes
541 Views, 3 Replies

Writing summaryInfo inside web service

Hey,

I want to read a custom property inside a .dwg file. I have the follwing code (c#) inside a web service (on the web server we have autocad installed) :

AcadApplication theApp = null;
AcadDocument theDoc = null;
try
{
// try get a running instance first
// if this fails it throws an exception
theApp = (AcadApplication)Marshal.GetActiveObject("AutoCAD.Application.17");
}
catch
{
// try to create a new instance of autocad
theApp = new AcadApplication();
}

theDoc = theApp.Documents.Open(Documentpath, null, null);

string theValue = string.Empty;
theDoc.SummaryInfo.GetCustomByKey(propertyName, out theValue);

if (theDoc != null)
theDoc.Close(false, null);


This code doesn't work when run under IIS using the default IUSR_XXX user. I works when run under a console applicatio n or using the visual studio web server (which runs under the current user), but the first time always give a problem creating an instance of the application object When autocad is already running is works fine. Does anyone have a clue.

Also is it possible to read custom properties from the summaryinfo without having autocad installed?

regards,
Henk
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: henkvanes

By default the account used run wep application has very limited access to
the computer resources (ASPNET, Network sevice, or IUSER_XXXX, depending on
your OS and the wep app's configuration). AutoCAD, as a compicated, rich
desktop application, certainly demanding more resources. So, you need to
configure your web app (web services, in your case) to run under a user
account with enough previlige. You might have to consider to impersonate to
a local power user or a domain account.

With that said, using AutoCAD in a service, especially a web service, is
highly not recommended. For example, just openning a drawing in Acad, you
may run into many possible problems that are very likely result in a message
box pops up and block the Acad from continuing. Do yo expect some go to the
server room so often to dismiss these possible message boxes?

Also, to use Acad this way, you may violate the Acad lisence (I am not very
certain on this, though).


wrote in message news:5613584@discussion.autodesk.com...
Hey,

I want to read a custom property inside a .dwg file. I have the follwing
code (c#) inside a web service (on the web server we have autocad installed)
:

AcadApplication theApp = null;
AcadDocument theDoc = null;
try
{
// try get a running instance first
// if this fails it throws an exception
theApp = (AcadApplication)Marshal.GetActiveObject("AutoCAD.Application.17");
}
catch
{
// try to create a new instance of autocad
theApp = new AcadApplication();
}

theDoc = theApp.Documents.Open(Documentpath, null, null);

string theValue = string.Empty;
theDoc.SummaryInfo.GetCustomByKey(propertyName, out theValue);

if (theDoc != null)
theDoc.Close(false, null);


This code doesn't work when run under IIS using the default IUSR_XXX user. I
works when run under a console applicatio n or using the visual studio web
server (which runs under the current user), but the first time always give a
problem creating an instance of the application object When autocad is
already running is works fine. Does anyone have a clue.

Also is it possible to read custom properties from the summaryinfo without
having autocad installed?

regards,
Henk
Message 3 of 4
Anonymous
in reply to: henkvanes

The code you show uses the ActiveX automation API; that is not the same
thing as the .NET API for AutoCAD which is the topic of this newsgroup.

Part of the solution (as far as this newsgroup is concerned) is to use the
.NET version of RealDWG (ObjectDBX) which will allow you to manipulate DWG
files w/o having AutoCAD installed. Unlike ObjectARX (and the accompanying
.NET APIs), RealDWG is not freely available.

Also, as has already been suggested in another reply, instantiating an
AutoCAD instance in a server application is not recommended and may violate
the license agreement:
3.2.4 Hosting or Third Party Use. You may not Install or Access, or allow
the Installation or Access of, the Autodesk Materials over the Internet,
including, without limitation, use in connection with a Web hosting,
commercial time-sharing, service bureau or similar service, or make the
Autodesk Materials available to third parties via the Internet on Your
computer system or otherwise. ...

Dan

"henkvanes" wrote in message news:5613584@discussion.autodesk.com...
Hey,

I want to read a custom property inside a .dwg file. I have the follwing
code (c#) inside a web service (on the web server we have autocad installed)
:

AcadApplication theApp = null;
AcadDocument theDoc = null;
try
{
// try get a running instance first
// if this fails it throws an exception
theApp = (AcadApplication)Marshal.GetActiveObject("AutoCAD.Application.17");
}
catch
{
// try to create a new instance of autocad
theApp = new AcadApplication();
}

theDoc = theApp.Documents.Open(Documentpath, null, null);

string theValue = string.Empty;
theDoc.SummaryInfo.GetCustomByKey(propertyName, out theValue);

if (theDoc != null)
theDoc.Close(false, null);


This code doesn't work when run under IIS using the default IUSR_XXX user. I
works when run under a console applicatio n or using the visual studio web
server (which runs under the current user), but the first time always give a
problem creating an instance of the application object When autocad is
already running is works fine. Does anyone have a clue.

Also is it possible to read custom properties from the summaryinfo without
having autocad installed?

regards,
Henk
Message 4 of 4
dmarcotte4
in reply to: henkvanes

Also is it possible to read custom properties from the summaryinfo without having autocad installed?


Maybe you can retrieve this data directly from a DXF file under
$CUSTOMPROPERTYTAG
and
$CUSTOMPROPERTY

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost