.NET

Reply
Active Contributor
pva75
Posts: 48
Registered: ‎07-22-2012
Message 1 of 23 (586 Views)

How to create linked objects (for network diagramm)?

586 Views, 22 Replies
07-28-2012 05:48 AM

Hello!

 

Can you help me to find way to create linked objects in AutoCad from C#?

 

I mean - for example, circle and some lines lined to this circle:

 

- If I move line it should be possible to move only one end point of line - second endpoint should be linked to the circle and not moved.

- If I move circle it should be move all endpoints of all lines linked to this circle.

 

In general I want to create network diagramm ("graph" in mathematical terms) from C# code.

 

Is it possible? May be anybody has code exapmle?

 

Thanks again,

Pavel.

*Expert Elite*
norman.yuan
Posts: 1,045
Registered: ‎04-27-2009
Message 2 of 23 (583 Views)

Re: How to create linked objects (for network diagramm)?

07-28-2012 06:05 AM in reply to: pva75

You might be able to do it with Jig or TransientGraphics or Overrule, or combination of them. Be warned, though, that all of them are quite advanced Acad .NET programming topics. And, TransientGraphics is onlay available since Acad2009 and Overrule is only available since Acad 2010.

 

 

Active Contributor
pva75
Posts: 48
Registered: ‎07-22-2012
Message 3 of 23 (580 Views)

Re: How to create linked objects (for network diagramm)?

07-28-2012 06:09 AM in reply to: norman.yuan

Thanks for quick answer. 2010+ is good for me.

 

But what overrule should I use? TransformOverrule, GeometryOverrule or ...?

 

Pavel.

Distinguished Mentor
gasty1001
Posts: 577
Registered: ‎04-11-2010
Message 4 of 23 (573 Views)

Re: How to create linked objects (for network diagramm)?

07-28-2012 10:51 AM in reply to: pva75

Hi,

 

If you need topological analysis, you can resort to AutoCAD Map and it's API that you can partner with Oracle Spatial (via FDO) to store topological data and even create topological querys and analysis, or you can get a class library like this :http://quickgraph.codeplex.com/, it have a comprehensive tool set oriented to graph creation, analysis, traversal and almost anything you need to do with a graph. Also you can create your own graph structure (a class or a struct), but you will have to implement all the rest (searching, traversing, up/down stream search, weights, etc). 

Actually  I'm using the quickgraph library in a concrete formwork solution with very good results (performance, stability, etc).

 

Gaston Nunez

Active Contributor
pva75
Posts: 48
Registered: ‎07-22-2012
Message 5 of 23 (567 Views)

Re: How to create linked objects (for network diagramm)?

07-28-2012 12:06 PM in reply to: gasty1001

Thanks! I known about quickgraph at codeplex. I agree that it's good library!

But... my current task is to create graph in AutoCad. Concrete - allow user to insert it in AutoCAD.

 

Pavel.

Board Manager
StephenPreston
Posts: 418
Registered: ‎05-22-2006
Message 6 of 23 (561 Views)

Re: How to create linked objects (for network diagramm)?

07-28-2012 03:35 PM in reply to: pva75

If you want to program this yourself, then overrules and/or constraints may help you. Take a look at the two AU classes of mine mentioned in Kean's blog here - http://through-the-interface.typepad.com/through_the_interface/2010/12/some-content-from-au-2010.htm.... The Overrule class includes a demo of a simple 'network' application I wrote.

 

Cheers,

Stephen Preston
Autodesk Developer Network
Active Contributor
pva75
Posts: 48
Registered: ‎07-22-2012
Message 7 of 23 (528 Views)

Re: How to create linked objects (for network diagramm)?

08-06-2012 02:50 AM in reply to: StephenPreston

Thanks for your example! But it's not exactly I want.

It's "virtual" polyline between circles. It's good, but I can't edit this polyline.

 

Is it possible to lock position of one point of line/polyline at all? May be with TransformOverrule or so on?

Result is that I can't move one point of line and can move other and change properties.

 

 

Thanks,

Pavel.

 

Active Contributor
pva75
Posts: 48
Registered: ‎07-22-2012
Message 8 of 23 (498 Views)

Re: How to create linked objects (for network diagramm)?

08-07-2012 09:59 AM in reply to: StephenPreston

I did it! Thanks all.

 

Pavel.

*Expert Elite*
norman.yuan
Posts: 1,045
Registered: ‎04-27-2009
Message 9 of 23 (472 Views)

Re: How to create linked objects (for network diagramm)?

08-11-2012 12:57 PM in reply to: pva75

Although you have solved your issue, you may still be interested in a post I just published, which was inspired by your question. Comments and critics are welcome.

 

http://drive-cad-with-code.blogspot.ca/2012/08/creating-linked-entities-with-drawjig.html

 

 

Active Contributor
pva75
Posts: 48
Registered: ‎07-22-2012
Message 10 of 23 (438 Views)

Re: How to create linked objects (for network diagramm)?

08-12-2012 01:33 PM in reply to: norman.yuan

Norman, your code is very interested. But... As I understand you use not "real" lines for shown links  - so user can't edit it. In my task I want to create real polyline and allow user to edit it except start and end points because they are linked.

 

Thanks!

 

Pavel.

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!