.NET

.NET

Reply
Mentor
santoshr0114
Posts: 162
Registered: ‎03-21-2012
Message 11 of 17 (624 Views)

Re: Retrieving block attribute using my VB.NET form application

05-09-2013 09:44 PM in reply to: bababarghi

Explore more COM objects. like AcadDocument, AcadBlockReference, AcadEntity, AcadBlockReference.

Using these you can update atributes using com

 

I am still not sure why do you need "netload"

Regards
Santosh
Contributor
bababarghi
Posts: 19
Registered: ‎05-01-2013
Message 12 of 17 (622 Views)

Re: Retrieving block attribute using my VB.NET form application

05-09-2013 09:57 PM in reply to: santoshr0114

 

I will advise soon. Thanks for that.  I need more sample codes for COM. That's all :smileyindifferent:


santoshr0114 wrote:

Explore more COM objects. like AcadDocument, AcadBlockReference, AcadEntity, AcadBlockReference.

Using these you can update atributes using com

 

 

 

That was a thought for doomsday. Not serious though -  until I could turn my head around COM solutions.


santoshr0114 wrote:

I am still not sure why do you need "netload"




Mentor
santoshr0114
Posts: 162
Registered: ‎03-21-2012
Message 13 of 17 (618 Views)

Re: Retrieving block attribute using my VB.NET form application

05-09-2013 10:05 PM in reply to: bababarghi

You cannot find samples using COM easily. Search on CAD forums

You have to explore more on yourself rather than finding samples. Searching will eat your time.

 

If i come acoss any i can help you.

 

And its good to be prepared for doomsday.

 

Regards
Santosh
Valued Mentor
DiningPhilosopher
Posts: 370
Registered: ‎05-06-2012
Message 14 of 17 (609 Views)

Re: Retrieving block attribute using my VB.NET form application

05-09-2013 11:15 PM in reply to: santoshr0114

santoshr0114 wrote:

Why do you need to call the netload command when all the fucnionality can be acieved without usig Netload.

 

to open just use AcadDocument doc = AcadApp.Documents.Open(DWGFILEPATH);

and then activate using doc.acivate();

 

then once the document / drawing is active you can perform your task to getting or updating the attributes.

 


Sorry, you're not really offering very good advice here.

 

Interprocess COM is extremely slow, and that is why loading the part of the application that does the heavy-lifting into AutoCAD's process is the preferred solution.

 

The OP can achieve that in one of two ways:

 

1.  NETLOAD the in-process component into AutoCAD via NETLOAD, executed using SendCommand() and invoke a command registered by the in-process component using SendCommand(). This is not the preferred solution because it is not synchronous, and therefore, the caller will not be able to wait until the process has completed.

 

2.  Expose the in-process component as a COM object, that would be accessed from the out-of-process component using the AcadApplication's GetInterfaceObject() method. This is the preferred solution, because it can be made fully-synchronous, allowing the caller to wait until the in-process component has completed its task on each file before moving on to the next file.  

 

When using option 2, the in-process COM object must be derived from System.ServiceModel.ServicedComponent to ensure that it runs in the STA threading context.

 

 

Contributor
bababarghi
Posts: 19
Registered: ‎05-01-2013
Message 15 of 17 (601 Views)

Re: Retrieving block attribute using my VB.NET form application

05-10-2013 01:23 AM in reply to: DiningPhilosopher

Thanks for the contribution DiningPhilosopher. Can you tell me more about your "option 2"?  The  current provided description sounds far beyond my knowledge on AutoCAD VB.NET programming. I am trying to improve though.

 

Therefore, a primitive approach i.e. communication with AutoCAD via COM looks more achievable option to me. Moreover, the speed is not super critical for my application. At this stage, the main purpose is to deliver the given task in a logical way.

 

Cheers

Valued Mentor
DiningPhilosopher
Posts: 370
Registered: ‎05-06-2012
Message 16 of 17 (595 Views)

Re: Retrieving block attribute using my VB.NET form application

05-10-2013 01:39 AM in reply to: bababarghi

Implementing a COM object in .NET that can be loaded into AutoCAD's process is fairly-advanced, and I don't have any VB.NET examples of that (or even a C# example that is 'bare-bones').

 

If speed is not critical, and you can do the job synchronously from another process then it may be the best approach given your ability, but it will be painfully-slow.

 

 

Mentor
santoshr0114
Posts: 162
Registered: ‎03-21-2012
Message 17 of 17 (590 Views)

Re: Retrieving block attribute using my VB.NET form application

05-10-2013 02:11 AM in reply to: DiningPhilosopher

I agree to your opinion DiningPhilosopher. But i haven't tried Exposing the in-process component as a COM object and i am not aware of the possibilites.

 

And i already suggested using In-Process communication in my first post as reply.

 

As the user will will be processing bunch of drawings at a time, so suggested using COM component. And yes the processing time is very slow compared to In-Process communication

Regards
Santosh
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.