Code Red > .NET

Using 1 entity to control another?

(1/3) > >>

Jeff_M:
Say I have a line and an arc. I want the line's length controlled by the arc's length. But, the arc is a hidden, not visible, object. So when the line is selected I want the grips for the arc to be displayed, and dragable, along with the line's grips. However, I do not want the implied selection set to be modified by just adding the arc to it. Is this even possible?

What I'm actually working with are an arc and a Civil3D curve label for that arc. It's the arc I want to be not visible, but it needs to be available for editing when the label is selected. I thought the line/arc would be simpler to explain... I have tried using the ImpledSelectionChanged event, checking for the Xdata I've added to the label, and adding the arc to the ImpliedSelectionSet if such a label is found. This actually works as I had hoped, except it breaks the normal C3D editing of labels which are in an ImpliedSelectionSet.

I've also tried to get the arc grip points and add those to the Label Grip points. This, so far, has resulted in lots of Fatal Errors so I changed it to the ImpliedSelectionChanged option. I would rather get this working, but am out of ideas. If I could get an example for the line/arc scenario, I'm sure I could adapt it for use with the label/arc.

 

Jeff_M:
Lots of views so I guess there's some interest in this. I've worked through a lot of this and have it working much as I had hoped for in a small sample class, which attached (developed using AutoCAD 2018, should work with any version 2010+). There are still 2 things that I'm struggling with.

The first, and it isn't a show stopper, is that I cannot get the arc to update as the grip is being dragged.

The second, and may be a show stopper, is that there are MANY entries added to the Undo stack. I've tried to use normal Transactions, OpenClose Transactions, no Transactions. All seem to leave the same number of Undo entries. I do not like this at all and am not seeing what I'm doing to cause all of these to be added.

Any help with either of these would be much appreciated. Here is a short video showing the sample tool in action.

https://www.screencast.com/t/CCDrzlHjonrI

Atook:

--- Quote from: Jeff_M on January 13, 2019, 07:20:00 PM ---Lots of views so I guess there's some interest in this...Here is a short video showing the sample tool in action.

https://www.screencast.com/t/CCDrzlHjonrI

--- End quote ---

Hey Jeff, I'm curious to see what you're trying to accomplish. The idea does seem like it could be very useful.

Any chance you can post a gif or a non-flash link to the video?

Jeff_M:
Here's a GIF created from the swf file. It starts slow, as I wasn't aware that it started recording.

Atook:
That is a cool implementation.

The idea of tying a visible object to an invisible one is interesting. How does the line know which invisible arc is it's parent? I'm currently tying two visible objects together by writing the handle of one as xdata on the other. That works as long as the user doesn't copy or pasteclip them.

As far as multiple undos, have you tried creating one transaction to start, and passing it to whatever functions need to be called?

Edit: I'd suggest a dynamic block, but I assume that's out since you're hoping to apply this to Civil3d objects.

Also, I just realized you posted code to read. Apologies for any silly questions answered in the code.

Navigation

[0] Message Index

[#] Next page

Go to full version