The DataCAD Developer Network (DDN) is an online resource for information and support for DCAL® (DataCAD Applications Language) developers as well as anyone interested in creating fonts, toolbars, hatch patterns, or linetypes for use in DataCAD.
#28076 by jmshehane
Mon Sep 17, 2007 3:52 pm
Here's a thinker for all of you...

I need to make a macro which welds all walls with an opening smaller than 5'. I'm currently working on some different approaches, but if any of you have one already or have any ideas, it would be appreciated greatly. Thanks,

PS, i'm programming for DCAD 9, not this DCAD 11 or 12 stuff. But really it doesn't matter as this question is more of an algorithm problem.
#28128 by Jsosnowski
Wed Sep 19, 2007 10:04 am
Each entity contains references to the previous and next entity in its record fields as well as a field "last" which indicates it is the last item in a group. When you create a wall, the first line entity is assigned an address and its "prev" field refers to the last entity created. A second field "Next" point to the next entity in the sequence. The second wall line would then be added refering to the first line entity in its "prev" field The first line would contain the second entity address in its "Next" field. If you use the Datacad menu - Architect/Opening option to create an opening in a wall, the two wall caps at the new opening location in the wall are inserted into the entity address chain sequence between the line segments of the orignal wall. If you have identified a wall group, it is possible to identify the original wall lines by testing if they are colinear. From there it would be posible to test the distances between them, to varify if they meet your size criteria, and perform a weld and a clean up since the inserted addresses for the wall caps are are available in the wall record data.

The Datacad weld procedure requires the user to identify a cleanup condition whereas it sounds tlike your macro would search the active database at large. The problem is that Datacad does not tag 2D walls any differently than any other line. So there may be plenty of opportunites for other collinear lines to confuse things. The testing you must do to isolate the wall conditions could be problematic. If you could simplify the situation by assigning some unique characteristic to wall lines beforehand it would make things easier in your macro. Perhaps linetype or color could be different? If you are working on drawings you have already generated, then you are back to the orignal problem.
#28187 by jmshehane
Thu Sep 20, 2007 2:46 pm
I actually created a working prototype. I grab all of the lines that make up the wall end caps, put them into a selection set, then determine which ones are parallel to each other and less than 5'. If they meet this criteria then I weld them. We are working only in 2D so I completely ignore any Z-height. My only issue now is when 2 wall caps happen to be less than 5' apart but have another wall or line in between them. I'm working with the intr_linlin function to tell my macro not to weld the wall if any lines are in between the 2 end points, but am running into a few snags. Thanks for the input.
#28237 by Jsosnowski
Sun Sep 23, 2007 11:09 am
I'm curious, how are you identifying which lines are end caps?

Are you manually identifying them or is the macro doing it? If the macro does, what criteria do you search for?
#28280 by jmshehane
Tue Sep 25, 2007 9:21 am
I thought about trying to manually find the wall end caps, but then decided just to prompt the user for the wall widths they would like closed. So if they return 5.5 then I grab every line that has a width of 5.5 and assume it's a wall cap. Then I run them through the rest of my algorithm.
#28290 by Jsosnowski
Tue Sep 25, 2007 12:49 pm
The concern I see with this is that if the walls are also capped at the other end, you may have a problem with the macro distinguishing what is what.

One further test you may want to consider is that the wall caps are linked to the wall by their addresses. Take a two line wall for instance. Each line entity has an address. It also has a prev & next. When the wall is created, the next field in line one will have the address of the second line. Similarly, the second line holds the address of the first in its prev field. When the wall caps are created, the addresses are linked as follows (assume wall extends from left to right):

Line 1 Lft <> Line 1 Rgt <> Cap Lft <> Cap Rgt <> Line 2 Lft <> Line 2 Rgt

If you find a short line you can examin the linked entities on each side of it. One should be the same length as your current one (another cap). The two lines on each side of the caps should be parallel and the distance of the cap length away from each other.

Who is online

Users browsing this forum: No registered users and 10 guests

About DataCAD Forum

The DataCAD Forum is a FREE online community we provide to enhance your experience with DataCAD.

We hope you'll visit often to get answers, share ideas, and interact with other DataCAD users around the world.

DataCAD

Software for Architects Since 1984