.NET

Reply
Board Manager
StephenPreston
Posts: 400
Registered: ‎05-22-2006
Message 11 of 23 (243 Views)

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

08-13-2012 10:52 AM in reply to: pva75

pva75 wrote:

I did it! Thanks all.

 



Hi Pavel,

 

Perhaps you'd like to share with us how you solved the problem. Did you use constraints or some other mechanism?

Cheers,

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

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

08-13-2012 11:17 AM in reply to: StephenPreston

Hi Stephen,

 

What I did:

 

1. On db.ObjectAppened I create ExtendedDictionary for new object and set obj.Modified event handler.

 

2. I have special command for add nodes (DBPoint) and lines (Line). When I add line I fill ExtendedDictionary for nodes where line started and ended.

 

3. In Modified handler I move all linked objects to the new position.

 

Also, I have handler for db.ObjectErased and clear ExtendedDictionary if line was removed.

 

Not resolved issue: how to prompt user to select point on the screen or object. I can use PromptPointOptions for point selection and PromptEntityOptions for node selection, but I want to enter point if it's not linked line or node if it's linked line. Now I use PromptPointOptions and check it by coordinate.

 

Pavel.

 

P.S. It's very strange that when I set Modified event this event raised. Also strange that ExtendedDictionary is not Dictionary and I should enumerate it to create real Dictionary.

 

 

Board Manager
StephenPreston
Posts: 400
Registered: ‎05-22-2006
Message 13 of 23 (233 Views)

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

08-13-2012 03:52 PM in reply to: StephenPreston

Thanks for sharing. The disadvantage of your approach is that the geometric relationships will be lost if someone edits your drawing without your app loaded. I believe a good alternative is to use the Parametric Drawing feature/API - that's a combination of geometric and dimensional constraints. But if you're happy with your solution, then no point in prolonging the discussion.

 

Off the top of my head - maybe the Editor.PointMonitor event will help you for your other problem.

Cheers,

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

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

08-13-2012 10:25 PM in reply to: StephenPreston

Hi Stephen,

 

Thanks for your support and this discussion. I can't say that I'm fully happy with my solution because it is required to create more handlers - if user add/move/delete objects (it's ok)  but also - undo/copy/paste and so on... All of it I should handle.

 

I'll check your proposal about Parametric Drawing API. I saw that it's possible to set geometric constrains in blocks. May be I can use such constrains in the schema.

 

Pavel.

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

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

08-14-2012 08:49 AM in reply to: StephenPreston
Stephen,
May be you have C# examples to create position (geometric?) constraint between two objects?
Pavel.
Board Manager
StephenPreston
Posts: 400
Registered: ‎05-22-2006
Message 16 of 23 (207 Views)

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

08-14-2012 11:04 AM in reply to: StephenPreston

I posted a link to my AU class on parametric drawing API earlier in this thread. I can't remember if the samples are C#, or VB.NET, or both - but the API calls are the same and easily translated using an online translator.

Cheers,

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

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

08-17-2012 04:43 AM in reply to: StephenPreston

I decice to stay with my solution because user can see constrains and delete it, but can't delete overrules.

 

 

Thanks,

Pavel.

Member
jackob85
Posts: 3
Registered: ‎06-08-2012
Message 18 of 23 (143 Views)

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

08-29-2012 12:55 AM in reply to: pva75

Hi Pavel,

i am trying to work on a similar task that you have posted but the problem that i am not familiar with advanced autocad programming .

Appreciate any help with a sample code or a link for the solution

 

Best Regards, jack

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

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

08-29-2012 08:36 AM in reply to: jackob85


--------------------------------------------------------------------------------

i am trying to work on a similar task that you have posted but the problem that i am not familiar with advanced autocad programming .


--------------------------------------------------------------------------------

Hi jack,

 


I'm also is not expert in AutoCad. It seems I'm junior novice :smileyhappy:

 

I can't public full code becuase it's prived code of my customer.

 

This main idea of my solution is very simple: store linked object handles in ExtendedDictionary and add Modify event handler. In this handler I have new postion of object and get handles of linked object and move all of it.

 

Additiona I should hadnle copy and delete events with the help of ObjectOverrule because I should clear ExtendedDictionary for copyed objects.

 

About ExtendedDictionay storage: http://adndevblog.typepad.com/autocad/page/17/

DrawOverrule: http://through-the-interface.typepad.com/through_the_interface/2009/04/customizing-the-display-of-st...

 

Post you questions here if I can help.

 

Pavel.

Active Member
Selevkos
Posts: 9
Registered: ‎04-05-2013
Message 20 of 23 (87 Views)

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

04-05-2013 10:13 PM in reply to: pva75

Hi Pavel,

 

My purpose is similar to yours. Can you explain how did you solve?

 

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

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