We have a set of electrical equipment that is commonly used in our designs. There are drawings of the electrical equipment with numbers inside circles, which identifies the materials needed for the device. The materials in the electrical equipment are numbered consecutively, say from 1 to 50. The drawing of the electrical equipment can be used in multiple projects; the only difference is the sequence of numbers. The problem: if the sequence changes, the draftsman needs to go through all of the circles and replace each of the numbers manually.
We are wondering if it’s possible to automate this process with a VBA program. The program input would be the initial number in the sequence; the program would then search through all the circles in the drawing and increment its number accordingly. The Microstation program we are using is v8.01. Any help on the matter would be greatly appreciated.
A circle is an ellipse having two equal radii. It doesn't have a number. You need to figure out how to find an ellipse that geometrically contains a text or tag element that displays the number.
Once you've figured out how to identify the ellipse/text combination, then you can build a list of those text or tag elements that need modification.
Regards, Jon Summers LA Solutions
If the circle is a set radius (which it makes sense to assume that it is), you could hunt for those specifically. You could (using VBA) set a fence by element using the circle, then go through the text elements inside the fence checking for numbers (using the 'Like' comparison operator or IsNumeric() function), and increment the found number accordingly.
If you can make sure that the circles and text are the only elements on a particular level, it will simplify things immensely.
In short, the answer to your question is yes, it is doable with VBA.
Thank you very much for your response. However, I will appreciate very much if I could get a simple example on how to apply this concept.
It would be helpful if you gave specifics about which portion of the concept you are having difficulty implementing in VBA.
There are plenty of examples in VBA help
We also published a number of VBA examples, including this one about scanning for elements.
Once you have found the Ellipse you can determine whether it is circular with a Boolean True/False check per below.
Gets a value indicating whether the object is a circle (i.e., whether its primary and secondary radii are equal).
Syntax
object.IsCircular
CADMinistrator ®