I'm making an autocad plugin and i want to create a new entity that is a combination of a line and the text.If i select the line the text is selected and backwords when i delete the line delete the text etc etc.How to treat them as one object referencing eachother?Is this possible?
-
2Did you thing of making it a block? You can work with blocks and blockreferences as if they're a single entity. – Daniel Möller Jul 18 '13 at 20:38
-
1A block seems like the most logical choice. – Trae Moore Jul 18 '13 at 23:20
-
thank you very much finally made them a single entity by making them blocks.One question how can i for example stretch the line? should i make a custom button to stretch it or it can be done via autocad? – Antonio Papa Jul 19 '13 at 08:15
3 Answers
I recommend using groups. Below is a link on how to access groups, I'm sure that site has more information on creating groups.
Users can control whether objects are selected with the group based on the system variable, PICKSTYLE. you can use ctrl+ h to toggle the PICKSTYLE value.

- 71
- 2
-
I tried making them groups but when i gruop selection is turned off they can still select the objects separately – Antonio Papa Jul 19 '13 at 07:49
-
Right, that's the point of the variable. If group selection is on, you get the behavior you want. I thought I'd leave that tip in there in case you had to troubleshoot for some of your users. – dwolfe Aug 02 '13 at 01:22
-
I made them block but i have to make extra commands for simple commands like extend the line ect.Is there an easy way to apply default autocad functionalities to the polyline inside a blockReference or blockTableRecorde – Antonio Papa Aug 02 '13 at 09:18
-
Another option - though it doesn't answer your question - and this is something for you to think about: is to create a new block which consists of the line and some text. The line can be an entity in your block, and the text can be a tag string value. the tag can be called "line_information".

- 33,477
- 14
- 111
- 80
I know this might be abit too late but there is a better more flexible way to do this, although it's not actually combining the two entities but rather more of a visual effect. It's called using Overrules. Basically you change the way the entity is displayed. So instead of displaying a line, you can display a circle, or in your case display a text and a line. Overruling is a very powerful tool, you can not only change how the entity looks but also add grips, remove grips, change how entity is highlighted or highlight other entities when your entity is highlighted, override some of the entity methods like erase and much more.
Best place to start from is Kean Walmsley's "Through the Interface" blog. And here is a link to this blog related to what you want to achieve

- 210
- 1
- 8