Controlling CAD layer by windows form application C#

Controlling CAD layer by windows form application C#

Anonymous
Not applicable
4,430 Views
9 Replies
Message 1 of 10

Controlling CAD layer by windows form application C#

Anonymous
Not applicable

Hi,

 

I am new here and novice about programming.

Can you please help me?

 

I can see my cad file into windows form application

Now I want make a list of cad layer and control the layers by selecting and deselecting in checkbox.

Later I want to calculate the area of my cad drawing by windows application.

 

I am eagerly waiting for any help.2017-01-04 (5).png

0 Likes
Accepted solutions (1)
4,431 Views
9 Replies
Replies (9)
Message 2 of 10

FRFR1426
Collaborator
Collaborator

Are you using the TrueView ActiveX control?

Maxence DELANNOY
Manager
Add-ins development for Autodesk software products
http://wiip.fr
0 Likes
Message 3 of 10

Anonymous
Not applicable

yes I am using ActiveX control.

I am using this code to load my CAD file to C#.

 

private void btnLoad_Click(object sender, EventArgs e)
{
if (System.IO.File.Exists(drawingPath.Text))

axAcCtrl1.PutSourcePath(drawingPath.Text);

else
MessageBox.Show("File does not exist");
}

 

Please help me....

0 Likes
Message 4 of 10

FRFR1426
Collaborator
Collaborator

OK, just stop here. DWG TrueView ActiveX control is not supposed to be used like that. This is not supported and beyond opening and printing documents, you cannot have access to the model, so you cannot list the layers. You need to use AutoCAD OEM or a third party library to display and interact with DWG.

Maxence DELANNOY
Manager
Add-ins development for Autodesk software products
http://wiip.fr
0 Likes
Message 5 of 10

Anonymous
Not applicable

upss... really? I am a novice 😞

 

can you please give me some idea/link where I can get information to display and control CAD file by C#

 

I would be very helpful for me...

0 Likes
Message 6 of 10

FRFR1426
Collaborator
Collaborator

There is a link in my answer to a StackOverflow question. Important thing to know is that there is no gratis solution for that.

Maxence DELANNOY
Manager
Add-ins development for Autodesk software products
http://wiip.fr
0 Likes
Message 7 of 10

Anonymous
Not applicable

So what do you suggest for getting my desire solution?

I want to build like this one but comparatively less function and only for calculating area.

Can you please have a look on that?

0 Likes
Message 8 of 10

norman.yuan
Mentor
Mentor

Considering that being a "novice", your best bet would be that your target users are all have AutoCAD installed, and you do the area calculation inside AutoCAD (COM API/VBA or .NET API), which is quite easy after the graphic entities being identified.

 

Without AutoCAD, the case would too complicated to plan/develop such an application before being very knowledgeable on all the technologies available/unavailable, IMO.

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 9 of 10

Anonymous
Not applicable

Thanks for your kind reply.

I can calculate area and select layers inside AutoCAD.

But I want to make a simpler and easier way to calculate area by Windows Application.

 

Sorry to say I did not get your link helpful as it is related to labeling.

 

Can you suggest me which way would be easier for me?

 

0 Likes
Message 10 of 10

norman.yuan
Mentor
Mentor
Accepted solution

I did not give any link related to your issue at hand.

 

Making things for you easier can only based on the technologies/knowledge/skills available to you. That is why I said using AutoCAD itself would be the best bet for you, considering the question you asked. If you really want to do things similar to the one referred in your link (an stand-alone window exe app without AutoCAD installation required), you would:

 

1. license RealDwg SDK (a few thousands $US). This is easy part if you have the money.

2. Find a way to generate a high quality drawing graphics out of DWG file without AutoCAD. Very difficult work for even a group of talented programmers, if it is possible/doable at all in a development case like yours. The best bet would be that you might be able to find/buy third part component for this, which could also be somewhat expensive.

3. Learn how to program with RealDwg SDK to deal with DWG file to manipulate data in it.

 

However, if you do it with AutoCAD, you only need to learn how to program AutoCAD (similar to step 3). After all, if you want to controll layer in Dwg file, wouldn't be very logical to use AutoCAD to do it, in most cases?

Norman Yuan

Drive CAD With Code

EESignature

0 Likes