Association of blocks and lines

Association of blocks and lines

Devin_11
Contributor Contributor
754 Views
6 Replies
Message 1 of 7

Association of blocks and lines

Devin_11
Contributor
Contributor

I am working on creating a pipeline, where a block represents a pump or reservoir which has defined attributes and a line or polyline represents a pipeline. Which looks like this:

kartheekv_0-1695614882197.png

When I try to move/stretch the line, the blocks won't move with the line because the blocks are associated with the insertion point. Is there someway to move the block together?

P.S. : This is a sample network, the actual pipe networks are much complicated and it is not possible to manually create a crossing window and stretching/moving them without disturbing the whole network.

 

Any inputs will be appreciated. Thank You!

0 Likes
Accepted solutions (1)
755 Views
6 Replies
Replies (6)
Message 2 of 7

kerry_w_brown
Advisor
Advisor

 

 

>>> . . . the blocks won't move with the line because the blocks are associated with the insertion point.

 

How are the blocks associated with the insertion point ??

 

You may need to re-state your question and provide more information.

Regards,


// Called Kerry or kdub in my other life.

Everything will work just as you expect it to, unless your expectations are incorrect. ~ kdub
Sometimes the question is more important than the answer. ~ kdub

NZST UTC+12 : class keyThumper<T> : Lazy<T>;      another  Swamper
0 Likes
Message 3 of 7

Devin_11
Contributor
Contributor

I meant that the blocks remain at the point where they are inserted unless  manually selected and moved.

It looks something like this, when I move the line:

kartheekv_0-1695627495147.png

I want the blocks and lines to move together just by selecting the line and moving them instead of selecting all the entities by a crossing window to move them. I want to know if this is possible in anyway.

 

Thanks

0 Likes
Message 4 of 7

_gile
Consultant
Consultant

Hi,

What about using a Group?



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 5 of 7

norman.yuan
Mentor
Mentor
Accepted solution

When you say "move or stretch", I assume you mean the pipe, as single Polyline, could be moved as whole, or one of its vertex is dragged/stretched. 

 

There could be different ways to get things done. The simplest way would be simply handle Database.ObjectModified event in conjunction with Document.CommandWillStart/Ended/Cancelled (when user drag, the command in the CommandEnded event's argument is "GRIP-STRETCH"): in the ObjectModified event handler, you test whether the said pipe polyline is changed or not and set a flag (or save its ObjectId) in class level; when a command finishes, test if the changed flag or pipe ObjectId is set. If yes, go ahead to move all the pump blocks to the locations they should be.

 

The drawback of this simple/easy coding task is that while user drags the pipe polyline, the blocks will not go with the dragged "ghost polyline" and user only see the block position change after the drag is done, thus not so much user-friendly.

 

The other advanced method would be using Overrule, probably a combination of ObjectOverrule/TransformOverrule/GripOverrule and a Jig opertaion. I can imagine that a custom GripOverule would make a user-friendly drag grip, similar to the ones you often see with C3D Aecc objects: when the pipe polyline is selected, the custom drag grip shows. When user drag it, a special Jig runs that make the polyline and blocks all moves as ghost images. Well, it is easy to say, but the coding of it would be a bit of challenging, or very challenging, depending on your skill level.

 

Norman Yuan

Drive CAD With Code

EESignature

Message 6 of 7

Devin_11
Contributor
Contributor
Hi,
Thank you for the response.
Grouping creates a problem when stretch is used and it is kind of a hassle to group and ungroup when we want to move an individual polyline when it is surrounded by 100s of polylines, all of which are joined together in a network.
0 Likes
Message 7 of 7

Devin_11
Contributor
Contributor
Thank you for the reply. I will give it a shot.
0 Likes