Time/Date Stamp

Procedure DS_Stamp;
VAR
	objectHd:HANDLE;
	dateValue:STRING;
BEGIN
	dateValue:=Date(2,1);
	objectHd:=GetObject('Date Stamp');
	SetText(objectHd,dateValue);
END;
Run(DS_Stamp);

What it does
Sets the value of a date stamp in your document.

Description
The macro uses a named text string object you create in your document. After creating the text object to be used as the date stamp, assign it the name 'Date Stamp' using the Object Info palette.

When the macro is executed, it uses the name to locate the object, and inserts the date and time into the object, replacing the original text.


Selecting All The Text On A Layer

Procedure TextFilter;
BEGIN
	DoMenuText('Active Only');
	DSelectAll;
	SelectObj((T=Text));
END;
Run(TextFilter);

What it does
Lets you select all the text on the active layer.

Description
The macro uses DoMenuText() to call the Active Only menu command, which causes only the active layer to be displayed. Any selected objects are then deselected, and procedure SelectObj() selects the objects which match the search criteria you have specified; in this case, all text objects.


Drawing a Leader Line

Procedure Leader_1;
VAR
	x1,y1,x2,y2,x3,y3:REAL;
BEGIN
	PushAttrs;
	GetLine(x1,y1,x2,y2);
	
	PenFore(37);
	PenSize(7);
	ArrowHead(0);
	MoveTo(x1,y1);
	LineTo(x2,y2);
	Redraw;
	
	GetPtL(x2,y2,x3,y3);
	Marker(1,0.225,15d);
	ArrowHead(2);
	LineTo(x3,y3);
	
	Group;
	DSelectAll;
	PopAttrs;	
END;
Run(Leader_1);

What it does
Allows you to draw a leader line by selecting the defining points of the leader line.

Description
The macro begins with a call to PushAttrs(), which saves the current attribute settings of the document. You are prompted to select the first two defining points of the leader; the pen attributes of the line are initialized and the first segment is drawn. You are then prompted for the final point defining the leader. A marker for the leader is defined and assigned to the leader line, and the final segment is drawn. The objects are then grouped for convenience, and the original attributes are restored using PopAttrs().


Setting Up Document Defaults

Procedure SetupQuartrDoc;
BEGIN
	SetPref(0,False);
	SetPref(1,False);
	SetPref(3,True);
	SetPref(17,True);

	NameClass('Existing Condition');
	NameClass('Proposed Work');
	NameClass('None');

	FillPat(0);
	GridLines(4');
	PenGrid(6");
	
	SetWallWidth(8");
END;
Run(SetupQuartrDoc);

What it does
Sets up your document's default settings.

Description
The macro sets various document defaults to your defined values, speeding initial document setup. Preerences are set using the SetPref() calls, classes are created, and other miscellaneous document attributes are initialized.


Reading Data From A Text File and Drawing Objects

Procedure ASCIIin;
VAR
	X,Y : REAL;
	TheFile : TEXT;
BEGIN
	GetFile(TheFile);
	IF NOT DidCancel THEN BEGIN
		WHILE NOT EOF(TheFile) DO BEGIN
			ReadLn(X,Y);
			Locus(X,Y);
		END;
		Close(TheFile);
	END;
END;
Run(ASCIIin);

What it does
The macro reads data from a data file you select, and uses the data to draw loci in the document.

Description
The macro is designed to read data in a tab delimited format from an ASCII text file. The file is processed by a loop which reads the data and draws the loci. In this instance, the data is pairs of values corresponding to an X-Y location in the document. An example file might be as follows:

12.00	2.00
14.00	3.50
0.00	4.75
1.15	6.98
The macro begins with a call to GetFile(), which invokes a standard file open dialog. After you exit the dialog, DidCancel() checks to see whether Cancel was selected; if selected, the macro skips the loop and the macro terminates execution. If OK was selected, the macro begins reading the data and drawing loci until the end of the data file is reached. The macro then reaches it's end and terminates execution.


Viewing A Model

Procedure VObView;
VAR
 	KCod : INTEGER;
BEGIN
	DoMenuText('Front');
	RedrawAll;
	Message('Press any key to change to left iso view...');

	GetKeyDown(KCod);
	DoMenuText('Left isometric');
	RedrawAll;
	Message('Press any key to change to right iso view...');
	GetKeyDown(KCod);
	DoMenuText('Right Isometric');
	RedrawAll;
	Message('Press key to change to plan view...');
	GetKeyDown(KCod);
	ClrMessage;
	DoMenuText('Top/Plan');
END;
Run(VObView);

What it does
Allows you to view a model from various views.

Description
The macro allows to setup an automated viewing script for displaying a model. The macro pauses for user input to change views.


Selecting And Modifying Subsets of Objects

Procedure ResetLWs;
VAR
	LayerName:STRING;
	objectHd:HANDLE;
	Type:INTEGER;
BEGIN
	DSelectAll;
	LayerName:=StrDialog('Enter layer to process','Layer-1');
	Layer(LayerName);
	SelectObj((L=LayerName) & (LW>1));
	
	objectHd:=FSActLayer;
	WHILE objectHd<>NIL DO BEGIN
		Type:=GetType(objectHd);
		IF (Type<>5)&(Type<>10)&(Type<>15)&(Type<>21) THEN
			SetLW(objectHd,1);
			
		objectHd:=NextSObj(objectHd);
	END;
END;
Run(ResetLWs);

What it does
Selects a subset of objects(in this case, all objects of line width > 1 mil) and modifies them as needed.

Description
The macro uses search criteria to select a subset of objects, which are then modified. In the example, we are assuming objects need to be prepared for DXF export; all objects whose line width is greater than 1 mil will be reset to 1 mil. You are prompted for a layer which will be processed; all objects on that layer are then processed. The macro skips text, symbols, polygons, and polylines.


Creating A Hybrid Window Symbol

Procedure Make3042_8Wall;
CONST
	Width=30";Height=42";
	
BEGIN
	DoMenuText('Top/Plan');
	
	BeginSym('3042dh');
		Rect(0",-4",Width,4");
		Rect(0,-4",1 1/2",4");
		Rect((Width-1 1/2),-4",Width,4");
	
		BeginXtrd(2'-0",(Height+2'-0"));
			FillPat(0);
			Rect(0",-4",Width,4");
		EndXtrd;
	
		BeginXtrd(2'-0",(Height+2'-0"));
			FillPat(1);
			FillBack(204);
			MoveTo(0,0");
			LineTo(Width,0");
		EndXtrd;
	EndSym;

	FillBack(0);
END;
Run(Make3042_8Wall);

What it does
Creates a hybrid window symbol.

Description
The macro creates all the components necessary for a hybrid(2D/3D) window symbol. The symbol is inserted into the top level of the document's symbol library. Constants are used for height and width to make it easier to modify the macro to create other size windows.


[Home][Advanced]