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.
#11988 by mikesmith
Sun Jun 04, 2006 3:11 pm
I have some macros and code to share if anyone would like them. They are 5 years old (the last time I tried my hand at writing macros) DOS-compiled.

Is there anywhere I can post all this, or do I need to put this up on a web page somewhere? Or I can e-mail it to anyone interested in using the code/macros.

Mike Smith

1. Absolute Zero:
===========
A working macro. Here is the code:

PROGRAM abslzero; {abslzero.dcs}

{This macro draws 2 lines, in the form of white crosshairs, }
{at the absolute zero point of the drawing, then windows in to }
{that area. }

TYPE
line_attribs = RECORD
ltype : integer;
width : integer;
spacing : real;
ovrshut : real;
color : integer;
END;

PROCEDURE add_line ( pnt1, pnt2 : point;
line : line_attribs);
PUBLIC;
{* Draws a single line on the screen given two points and the attributes
* for the line.
*}

VAR
ent : entity;

BEGIN
ent_init (ent, entlin);
ent.linpt1 := pnt1;
ent.linpt2 := pnt2;
ent.linpt1.z := zbase; ! this line will have no height
ent.linpt2.z := zbase;
ent_add (ent);
ent.ltype := line.ltype;
ent.width := line.width;
ent.spacing := line.spacing;
ent.ovrshut := line.ovrshut;
ent.color := line.color;
ent_update (ent);
ent_draw (ent, drmode_white);
END add_line;


PROCEDURE main;

var
line : line_attribs;
pnt1,
pnt2 : point;

begin
pnt1.x := -192.0;
pnt1.y := 0.0;
pnt1.z := 0.0;

pnt2.x := 192.0;
pnt2.y := 0.0;
pnt2.z := 0.0;

line.ltype := ltype_solid;
line.width := 1;
line.spacing := 1.0;
line.ovrshut := 0.0;
line.color := clrwhite;

add_line (pnt1, pnt2, line);

pnt1.x := 0.0;
pnt1.y := -192.0;
pnt1.z := 0.0;

pnt2.x := 0.0;
pnt2.y := 192.0;
pnt2.z := 0.0;

line.ltype := ltype_solid;
line.width := 1;
line.spacing := 1.0;
line.ovrshut := 0.0;
line.color := clrwhite;

add_line (pnt1, pnt2, line);

pnt1.x := -384.0;
pnt1.y := -384.0;
pnt1.z := 0.0;

pnt2.x := 384.0;
pnt2.y := 384.0;
pnt2.z := 0.0;

{pass our revised pnt1, pnt2 to windowin}
windowin(pnt1, pnt2);

end main;


begin
main;

end abslzero.

==================================
==================================

2. The second macro is much more complicated and I never finished it. I made standalone .DCX files for each module, but never got the whole thing together. I never understood HOW to get them all together, so that part of the main codes is probably laughable since I had no idea what I was doing.

The original idea for this macro was and open source idea where programmers on the DDN Website would take up the code, discuss it, modify it, and post the results, which would be integrated by consensus. But nobody ever took me up on it so nothing came of it.

Here is the description:

Metal Stud/Framing Macro:
=================
A macro to draw metal studs in elevation or plan, similar to the Steel
Pro macro. In elevation and plan view the entities would be drawn as 2D
lines. In section they would be drawn as an open polyline.

This is perhaps not necessarily a simple macro (?), but it seems
basically repetative in nature, since most of the shapes are the same
but with different dimensions, and would incorporate many aspects of
DCAL.

Here was the idea for the basic menu structure for this:

Main Menu
Studs
Runners
Shapes
ShftWall

Studs Menu
1-5/8"
2-1/2"
3-5/8"
4"
6"
7-1/4"
8"
9-1/4"
11-1/2"
13-1/2"

Runners Menu
1-5/8"
2-1/2"
3-5/8"
4"
6"
7-1/4"
8"
9-1/4"
11-1/2"
13-1/2"

Shapes Menu
7/8" Hat
ReslChnl {1-1/2" Resilient Channel}
CR 3/4 {3/4" Cold Rolled Channel}
CR 1-1/2 {1-1/2" Cold Rolled Channel}
Z 1"
Z 1-1/2"
Z 2"
Z 3"

Shaft Wall Menu
CH-2-1/2
CH-4
Rn-2-1/2 {runner for 2-1/2" CH}
Rn-4 {runner for 4" CH}

Note: Clicking on any of the above options will bring up a view menu,
like this:

View Menu
Section {draws a polyline section view}
Top/Bttm {draws parallel 2D lines that stretch with the cursor}
Front {draws parallel 2D lines that stretch with the cursor}
Back {draws parallel 2D lines that stretch with the cursor}

ByCenter {Toggle ON - draws the entities from center (of lines or
section)}
ByCorner {Toggle ON - draws the entities from one corner}
Note: These two options are self-cancelling. When one is ON the
other is OFF.

To start with everything could be drawn with fixed colors. Then perhaps
we could later add support for user-defined colors that could be stored
in an external database. Still later we could add support for metric
studs (or perhaps we would just create a metric version of the macro by
changing the data as required).

Who is online

Users browsing this forum: No registered users and 24 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