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

C#.Net web Application

3 REPLIES 3
Reply
Message 1 of 4
sree_swathi
718 Views, 3 Replies

C#.Net web Application

Hello ,

I am new to developing AutoCAD enabled applications.

I need to upload certain dwg files and perfom some tasks on them. One basic functionality that I am looking for is Zoom to Extents.

Scenario:

User enters the top left and lower right corner coordinats and he should be able to reset the extents on that file that was uploaded

Using the following code am able to access the extents but unable to reset them to the values entered by the user.

Thanks in advance for any help offered.
-Swathi

Code :
AcadApplication acadApp = new AcadApplication();
AcadDocument acadDoc = acadApp.Documents.Open("D:\\test\\GA.dwg", false, null);

IAcadViewport acadViewPort = acadDoc.ActiveViewport;

Response.Write(acadViewPort.Height.ToString());
Response.Write("\n");
Response.Write(acadViewPort.Width.ToString());
Response.Write("\n");
Response.Write(acadViewPort.LowerLeftCorner.ToString());
Response.Write("\n");
Response.Write(acadViewPort.UpperRightCorner.ToString());
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: sree_swathi

Hi,

I think that what you are trying to do (running AutoCAD in a web server),
it's explicitly forbidden in the AutoCAD Eula.

-gnb




"sree_swathi" wrote in message news:6337788@discussion.autodesk.com...
> Hello ,
>
> I am new to developing AutoCAD enabled applications.
>
> I need to upload certain dwg files and perfom some tasks on them. One
> basic functionality that I am looking for is Zoom to Extents.
>
> Scenario:
>
> User enters the top left and lower right corner coordinats and he should
> be able to reset the extents on that file that was uploaded
>
> Using the following code am able to access the extents but unable to reset
> them to the values entered by the user.
>
> Thanks in advance for any help offered.
> -Swathi
>
> Code :
> AcadApplication acadApp = new AcadApplication();
> AcadDocument acadDoc =
> acadApp.Documents.Open("D:\\test\\GA.dwg", false, null);
>
> IAcadViewport acadViewPort = acadDoc.ActiveViewport;
>
> Response.Write(acadViewPort.Height.ToString());
> Response.Write("\n");
> Response.Write(acadViewPort.Width.ToString());
> Response.Write("\n");
> Response.Write(acadViewPort.LowerLeftCorner.ToString());
> Response.Write("\n");
> Response.Write(acadViewPort.UpperRightCorner.ToString());
Message 3 of 4
sree_swathi
in reply to: sree_swathi

Hello,

Thank you for your response.

Please let me know if there is any work arround for this. Can we open the drawing file and pass command line arguments to it...

I am able to open the document and access various properties.....
Message 4 of 4
norman.yuan
in reply to: sree_swathi

Put the issue of possible license violation aside, technically, AutoCAD can be automated via its COM APIs on the its computer, be it a web server or CAD station, as you did with the first couple of lines. You just need to learn more on Acad's COM API and how to use it to manipulate drawing content.

However, there is a lot more to consider if it is a feasible technically: Acad is a heavy, resource-hungry application. Do you want each web request from a user to start an instance of Acad on the web server? Acad's startup depends on so many factors and very likely pops up different message boxes waiting human responds for so many reasons. So, what if a messagew box blocks Acad and waiting someone to click "OK"?

So, even you can run/automate Acad on the web server (or other type of server, or a user computer) as unattented process, it is unlikely reliable/useful at all.

Norman Yuan

Drive CAD With Code

EESignature

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