PDA

View Full Version : Problem with LabelCurves and MVBlockRefs



aquaman
2008-09-25, 07:37 AM
Hello everybody!

First of all I’m using MEP 2008.

Second: I have used the search button, but no luck!


I have a drawing, which has devices and wires in it. For these objects there are MVBlockRefs and LabelCurves showing different properties. Every device and wire has a custom property set. I am trying to create a macro, that hides all objects, that have a property in this property set equal to given. I got it working for the devices and wires, but the labels associated with them are the problem. As the labels doesn't have the property set, I need to know, how to get the referenced object.

My code scans the ThisDrawing.ModelSpace to acquire objects and labels:

For Each Item In ThisDrawing.ModelSpace
If ((Item.ObjectName = "AecbDbDevice") Or (Item.ObjectName = "AecbDbConduit") Or (Item.ObjectName = "AecbDbConduitFitting") Or (Item.ObjectName = "AecbDbWire") Or (Item.ObjectName = "AecDbMvBlockRef") Or (Item.ObjectName = "AecbDbLabelCurve")) Then

...

So I get the objects for the labels, but not the oject the label is referring to (device or wire). Thought property OwnerID will give out this information, but it refers to the Modelspace object.

Does anyone know, how to get the object, label is referring to?

Regards,
Rait Raak

RobertB
2008-09-25, 03:14 PM
Not that this post is really going to help you, but: if you are doing MEP customization, VBA is not the language to use. .NET is the API that Autodesk is improving. VBA is a dead horse for API development.

jwanstaett
2008-09-26, 12:13 PM
use the GetAnchor Method on the label object this will return an AecAnchorTagToEnt object if the label is attach as and schedule tag. Use the Reference Property of the AecAnchorTagToEnt object to get the entity the labe is tag to.

aquaman
2008-09-29, 08:50 AM
Hello!

RobertB,
thanks for the pointer. Started reading a book about ARX with visual studio. At first glance objects and methods are the same as in VBA, so I do not see something much better. I will continue learning it this week. Of course writing in C++ is heavenly compared to basic:)

jwanstaett,
thank you! The method works, but only for MVBlockRefs. For LabelCurves it gives out error message saying "Method 'GetAnchor' of object 'IAecbLabelCurve' failed"

Regards,
Aq