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?
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.
Thanks for quick answer. 2010+ is good for me.
But what overrule should I use? TransformOverrule, GeometryOverrule or ...?
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).
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.
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_t
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.
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.
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.
Access a broad range of knowledge to help get the most out of your products and services.