Jump to content
Sign in to follow this  
Hippocode

Script to list all symbols in an area

Recommended Posts

Tweak the script as you need it, as it is written for my custom records and space objects, but hey it works here.

=> draw space objects on a layer.

=> Add a record with a field on each symbol you will use, change the record and fieldnames in the script or keep the current ones.

=> add symbols to that layer, or another layer with the same level ( example: object on "niv 0", symbol on "0 symbols", both share 0 as level )

=> Make sure your are in the layer with symbols before running the script.

=> Run the script once, when no error message appears, all symbols will have the spacename in their record

=> Make a worksheet, dbrow that searches for a value in that record field

=> sort+sum on spacename and then on symbol name

=> you have a list of symbols/each room/space

I would like to thank everyone for helping me out with all my questions, without this forum I probably wouldn't have made it !

Procedure FindSymbols;
VAR
i,j:											INTEGER;
temp_string,defaultRecName,defaultFieldName:				STRING;
originPt:										POINT;

ObjectHandle, PolyHandle:DYNARRAY [] OF HANDLE;
SpaceName: DYNARRAY [] OF STRING;
SpaceXOrigin,SpaceYOrigin: DYNARRAY [] OF REAL;

  	handleArrayCount,ArrayCounter :INTEGER;
  	handleArrayAlloc :INTEGER;

FUNCTION GetSymbols(SymHandle:HANDLE) :BOOLEAN;
VAR
	symPt:					POINT;
	SymbolName,recName:			STRING;
BEGIN
	FOR j:=1 TO NumRecords(SymHandle) DO BEGIN
		recName := GetName(GetRecord(SymHandle, j));
		IF recName = defaultRecName THEN BEGIN
			SymbolName:=GetSymName(SymHandle);
			IF SymbolName <>'' THEN BEGIN
				GetSymLoc(SymHandle,symPt.x,symPt.y);
				FOR i:=1 TO handleArrayAlloc DO BEGIN
					IF PtInPoly(symPt.x-SpaceXOrigin[i],symPt.y-SpaceYOrigin[i],PolyHandle[i]) THEN BEGIN
						{for testing only: AlrtDialog(concat(SymbolName,' IS FOUND IN ',SpaceName[i],' ON : x=',symPt.x,' y=',symPt.y));}

						{ Store new string }
						SetRField(SymHandle,recName,defaultFieldName,SpaceName[i]);
					END;
				END;
			END;
		END;
	END;
END;

Procedure GetSpace(ObjHnd:HANDLE);
BEGIN
	{ Check for Handle to excist }
	ObjectHandle[ArrayCounter]:=ObjHnd;

	{ Handle Found, continue }
	IF ObjectHandle[ArrayCounter] <> NIL THEN BEGIN
		{ Get space info }
		SpaceName[ArrayCounter]:=GetRfield(ObjHnd,'TDE_Space','__SpaceName');
		{ Get the path }
		PolyHandle[ArrayCounter]:=GetCustomObjectPath(ObjHnd);
		{ Get the space insertion point to correct the coordinates when comparing }
		GetSymLoc(ObjHnd,SpaceXOrigin[ArrayCounter], SpaceYOrigin[ArrayCounter]);
	END;
	ArrayCounter:=ArrayCounter+1;
END;
BEGIN
{ The record/field name of the used symbols }
defaultRecName:='TDE_00 algemeen';
defaultFieldName:='Ruimte';
temp_string:=GetLName(ActLayer);

{ only use the space objects on the right constructionlevel }
IF POS('-1', temp_string)<>0 THEN BEGIN
	handleArrayAlloc:=COUNT((PON=TDE_Space) & (L='niv -1'));
END
ELSE IF POS('0', temp_string)<>0 THEN BEGIN
	handleArrayAlloc:=COUNT((PON=TDE_Space) & (L='niv 0'));
END
ELSE IF POS('+1', temp_string)<>0 THEN BEGIN
	handleArrayAlloc:=COUNT((PON=TDE_Space) & (L='niv +1'));
END
ELSE IF POS('+2', temp_string)<>0 THEN BEGIN
	handleArrayAlloc:=COUNT((PON=TDE_Space) & (L='niv +2'));
END
ELSE IF POS('+3', temp_string)<>0 THEN BEGIN
	handleArrayAlloc:=COUNT((PON=TDE_Space) & (L='niv +3'));
END
ELSE BEGIN
	handleArrayAlloc:=COUNT((PON=TDE_Space));
	Message('No level found, ALL spaceobjects will be used');
END;

IF handleArrayAlloc > 0 THEN BEGIN
	{ Define arrays }
	ALLOCATE ObjectHandle [1..handleArrayAlloc];
	ALLOCATE PolyHandle [1..handleArrayAlloc];
	ALLOCATE SpaceName [1..handleArrayAlloc];
	ALLOCATE SpaceXOrigin [1..handleArrayAlloc];
	ALLOCATE SpaceYOrigin [1..handleArrayAlloc];

	{ Loop trough each custom space object and store handles and general info in arrays }
	ArrayCounter:=1;
	IF POS('-1', temp_string)<>0 THEN BEGIN
		ForEachObject(GetSpace,((PON=TDE_Space) & (L='niv -1')));
	END
	ELSE IF POS('0', temp_string)<>0 THEN BEGIN
		ForEachObject(GetSpace,((PON=TDE_Space) & (L='niv 0')));
	END
	ELSE IF POS('+1', temp_string)<>0 THEN BEGIN
		ForEachObject(GetSpace,((PON=TDE_Space) & (L='niv +1')));
	END
	ELSE IF POS('+2', temp_string)<>0 THEN BEGIN
		ForEachObject(GetSpace,((PON=TDE_Space) & (L='niv +2')));
	END
	ELSE IF POS('+3', temp_string)<>0 THEN BEGIN
		ForEachObject(GetSpace,((PON=TDE_Space) & (L='niv +3')));
	END
	ELSE BEGIN
		ForEachObject(GetSpace,((PON=TDE_Space)));
	END;

	{ Loop trough all the symbols once, but check their location on each space object }
	{ Only using the symbols of the current active layer ! }
	ForEachObjectInLayer(GetSymbols,0,2,0);
END
ELSE BEGIN
	Message('No space objects found   :(');
END;
END;
Run(FindSymbols);

Share this post


Link to post

Hi hippothamus

I've only just started looking at scripting so please forgive me if I ask simple questions! Is the red text below the only place I need to enter my own record name and field name?

{ The record/field name of the used symbols }

defaultRecName:='TDE_00 algemeen';

defaultFieldName:='Ruimte';

temp_string:=GetLName(ActLayer);

When I do this and run the script it comes up with an error report.

I can post the error report if this helps?

Any info would be greatly appreciated!

Thanks,

Will

Share this post


Link to post
Hi hippothamus

I've only just started looking at scripting so please forgive me if I ask simple questions! Is the red text below the only place I need to enter my own record name and field name?

{ The record/field name of the used symbols }

defaultRecName:='TDE_00 algemeen';

defaultFieldName:='Ruimte';

temp_string:=GetLName(ActLayer);

When I do this and run the script it comes up with an error report.

I can post the error report if this helps?

Any info would be greatly appreciated!

Thanks,

Will

Hi Will,

Yes you have to change those red texts. But be sure your symbols have that record attached AND that record has a text field as DefaultFieldName so it can store the spacename in it.

Make sure that your symbols and the space objects can be found in the same active layer when running the script.

If that, however still gives your an error feel free to post it.

Also, you could try my newer version of the script, as the previous one searched for particular layer names this one only searches for an indication of a level in the active layer (Custom LayerName -1,0,+5) etc

Procedure FindSymbols;
VAR
i,j,k,l,EmptySpaceCounter,SymbolCounter,SpaceCounter:					INTEGER;
LayerName,defaultRecName,defaultFieldName,DBCrit,SearchString,DBString:	STRING;
originPt:												POINT;

ObjectHandle, PolyHandle:DYNARRAY [] OF HANDLE;
SpaceName: DYNARRAY [] OF STRING;
SpaceXOrigin,SpaceYOrigin: DYNARRAY [] OF REAL;

  	handleArrayCount,ArrayCounter :INTEGER;
  	handleArrayAlloc :INTEGER;

FUNCTION GetSymbols(SymHandle:HANDLE) :BOOLEAN;
VAR
	symPt:					POINT;
	SymbolName,recName:			STRING;
BEGIN
	FOR j:=1 TO NumRecords(SymHandle) DO BEGIN
		recName := GetName(GetRecord(SymHandle, j));
		IF recName = defaultRecName THEN BEGIN
			SymbolName:=GetSymName(SymHandle);
			IF SymbolName <>'' THEN BEGIN
				GetSymLoc(SymHandle,symPt.x,symPt.y);
				FOR i:=1 TO handleArrayAlloc DO BEGIN
					IF (PtInPoly(symPt.x-SpaceXOrigin[i],symPt.y-SpaceYOrigin[i],PolyHandle[i])) AND (SpaceName[i]<>'') THEN BEGIN
						{for testing only: AlrtDialog(concat(SymbolName,' IS FOUND IN ',SpaceName[i],' ON : x=',symPt.x,' y=',symPt.y));}
						{ Store new string }
						SetRField(SymHandle,recName,defaultFieldName,SpaceName[i]);
						SymbolCounter:=SymbolCounter+1;
					END;
				END;
			END;
		END;
	END;
END;

Procedure GetSpace(ObjHnd:HANDLE);
BEGIN
	{ Check for Handle to excist }
	ObjectHandle[ArrayCounter]:=ObjHnd;

	{ Handle Found, continue }
	IF ObjectHandle[ArrayCounter] <> NIL THEN BEGIN
		{ Get space info }
		IF GetRfield(ObjHnd,'TDE_Space','__SpaceName') <> '' THEN BEGIN
			SpaceName[ArrayCounter]:=GetRfield(ObjHnd,'TDE_Space','__SpaceName');
		END;
		IF (GetRfield(ObjHnd,'Space','Number') <> '') OR (GetRfield(ObjHnd,'Space','Name') <>'') THEN BEGIN
			IF  (GetRfield(ObjHnd,'Space','Number') <> '') AND (GetRfield(ObjHnd,'Space','Name') <>'') THEN BEGIN
				SpaceName[ArrayCounter]:=concat(GetRfield(ObjHnd,'Space','Number'),': ',GetRfield(ObjHnd,'Space','Name'));
			END
			ELSE IF GetRfield(ObjHnd,'Space','Number') <> '' THEN BEGIN
				SpaceName[ArrayCounter]:=GetRfield(ObjHnd,'Space','Number');
			END
			ELSE BEGIN
				SpaceName[ArrayCounter]:=GetRfield(ObjHnd,'Space','Name');
			END;
		END;
		{ Get the path }
		PolyHandle[ArrayCounter]:=GetCustomObjectPath(ObjHnd);

		{ Get the space insertion point to correct the coordinates when comparing }
		GetSymLoc(ObjHnd,SpaceXOrigin[ArrayCounter], SpaceYOrigin[ArrayCounter]);
		IF SpaceName[ArrayCounter]='' THEN BEGIN
			EmptySpaceCounter:=EmptySpaceCounter+1;
		END
		ELSE BEGIN
			SpaceCounter:=SpaceCounter+1;
		END;
	END;
	ArrayCounter:=ArrayCounter+1;
END;
BEGIN
{ The record/field name of the used symbols }
defaultRecName:='TDE_00 algemeen';
defaultFieldName:='Ruimte';
LayerName:=GetLName(ActLayer);

{ This part searches for a level in the layer name, ex: (-5,0,+2) so it will only compare the symbols with one layer only, the on you are in at this moment. }
FOR k:=-5 TO 5 DO BEGIN
	IF k > 0 THEN SearchString:=concat('+',k) ELSE SearchString:=concat(k);

	IF POS(SearchString, LayerName) <> 0 THEN BEGIN
		DBCrit:=concat('((PON=TDE_Space) | (PON=Space)) & (L=',chr(39),'niv ',SearchString,chr(39),')');
		handleArrayAlloc:=COUNT(DBCrit);
		DBString:=SearchString;
	END;
END;

IF handleArrayAlloc > 0 THEN BEGIN
	{ Define arrays }
	ALLOCATE ObjectHandle [1..handleArrayAlloc];
	ALLOCATE PolyHandle [1..handleArrayAlloc];
	ALLOCATE SpaceName [1..handleArrayAlloc];
	ALLOCATE SpaceXOrigin [1..handleArrayAlloc];
	ALLOCATE SpaceYOrigin [1..handleArrayAlloc];

	{ Loop trough each custom space object and store handles and general info in arrays }
	ArrayCounter:=1;
	ForEachObject(GetSpace,DBCrit);

	{ Loop trough all the symbols once, but check their location on each space object }
	{ Only using the symbols of the current active layer ! }
	ForEachObjectInLayer(GetSymbols,0,2,0);
END
ELSE BEGIN
	AlrtDialog(concat('Geen ruimte objecten gevonden in layer niv ',DBString));
END;
IF EmptySpaceCounter > 0 THEN BEGIN
	IF EmptySpaceCounter = 1 THEN AlrtDialog(concat('Er is ',EmptySpaceCounter,' space object gevonden zonder naam, deze werd genegeerd' ))
	ELSE AlrtDialog(concat('Er zijn ',EmptySpaceCounter,' space objecten gevonden zonder naam, deze werden genegeerd' ));
END;
IF SymbolCounter > 0 THEN BEGIN
	IF SpaceCounter = 1 THEN BEGIN
		IF SymbolCounter = 1 THEN AlrtDialog(concat('Er is ',SymbolCounter,' symbool gevonden in ',SpaceCounter,' ruimte en benoemd' ))
		ELSE AlrtDialog(concat('Er zijn ',SymbolCounter,' symbolen gevonden in ',SpaceCounter,' ruimte en benoemd' ));
	END
	ELSE IF SpaceCounter > 1 THEN BEGIN
		IF SymbolCounter = 1 THEN AlrtDialog(concat('Er is ',SymbolCounter,' symbool gevonden in ',SpaceCounter,' ruimtes en benoemd' ))
		ELSE AlrtDialog(concat('Er zijn ',SymbolCounter,' symbolen gevonden in ',SpaceCounter ,'  ruimtes en benoemd' ));
	END;
END
ELSE BEGIN
	AlrtDialog(concat('Er zijn geen symbolen gevonden in layer ',chr(39),LayerName,chr(39),' die zich in een benoemde ruimte bevinden.'));
END;
END;
Run(FindSymbols);

Edited by hippothamus

Share this post


Link to post

Hi hippothamus

Thanks for the response on this however I am still having trouble getting the script to work properly. My knowledge of scripting is very basic so I am finding it difficult to read your script.

Would it be possible for you to post a small VWKs file with a space object and a couple of symbols so I can run the above script and see how the script relates to your layer names, record names and field names?

Thanks again,

Will

Share this post


Link to post

Here you go..

I tweaked the script so it doesn't loop trough multiple layers, instead it will just use all the "space objects" and "symbols" on the current active layer.

I've also added a custom record and a field that is used to store the location name.

Share this post


Link to post

Success! Thanks for posting the vwks file, it helped a lot! I've managed to edit the script to suit my way of working.

Is there a way to search all layers? For instance we usually lay the architect floor plan (space names) on one layer and then place our furniture symbols on another layer.

thanks again,

Will

Share this post


Link to post

yeah that's possible.

Make sure that you can link the layer of the symbols with the other layer containing the space objects.

If you have multiple "levels" this can be easily done by naming your layers in an easy-to-script solution :P

The way I'd do it:

Layers spaceobjects: NIV 0, NIV +1, etc

Layers symbols NIV 0 elek, NIV +1 elek etc...

mutual parts "0,+1,-1"

I'd use a loop from -5 to +5, that assembles both layer names with the concat function. This way you can compare each objectlayer with the right symbol layer

The script uses FOREACHOBJECTINLAYER to select all the symbols in the current layer, that has to be changed into selecting all the symbols in the layer with the custom name, therefor you could use FOREACHOBJECT and add criteria to select all symbols in layer X

Let me know if you need any more help on this matter.

Edited by hippothamus

Share this post


Link to post

So if I wanted to search through all of my layers for space objects and symbols do I need to change the red line below?

BEGIN

{ The record/field name of the used symbols }

defaultRecName:='CFG';

defaultFieldName:='Room Name';

temp_string:=GetLName(ActLayer);

{ only use the space objects on the current layer }

As I say this is the first time i've tried to use scripting so I am still trying to 'read' the script and understand how it works, hence my severe lack of knowledge.

Thanks

Share this post


Link to post
So if I wanted to search through all of my layers for space objects and symbols do I need to change the red line below?

BEGIN

{ The record/field name of the used symbols }

defaultRecName:='CFG';

defaultFieldName:='Room Name';

temp_string:=GetLName(ActLayer);

{ only use the space objects on the current layer }

As I say this is the first time i've tried to use scripting so I am still trying to 'read' the script and understand how it works, hence my severe lack of knowledge.

Thanks

Well, to explain it a bit further,

you need a function that loops trough each layer instead of only one.

With FOREACHOBJECTINLAYER, you loop trough all objects in the current layer only, so we can't use it any further.

FOREACHOBJECT will loop trough all objects, with custom criteria. The same you can have a custom selection under " tools / custom selection ".

There is an example in the script:

line 81:

this creates the critera "((PON='Space') AND (L='LayerName'))"

DBCrit:=concat('(PON=',chr(39),'Space',chr(39),') & (L=',chr(39),temp_string,chr(39),')');

Line 96:

ForEachObject(GetSpace,DBCrit);

This will loop trough all objects with the name "Space" and the objectLayer "LayerName". In this loops, it will excecute the subprocedure GetSpace for each found object.

GetSpace will store all the spaceobjects in arrays so we can use them later.

GetSymbols will as it is now, loop trough all the symbols in the current layer, those will be compared with the just stored spaceobjects.

There needs to be a loop before both these functions, in that loop you get different layernames, different critera, and a result for each layer.

Edited by hippothamus

Share this post


Link to post

My guess its not easy for a beginner in vectorscript, IF you just prefer the working code without making it yourself, I'll write it for you, hence I need it myself anyway.

END

ELSE I'd gladly help you trough the code. END;

Share this post


Link to post

Hi

Ultimately I would like to learn Vectorscript to improve our workflow and efficiency, however fitting it in around day to day work means progress is slow.

If you need the code anyway then I would really appreciate you sending it to me if you don't mind writing it. I am keen to see how it is done and to implement it into our way of working.

I really appreciate the help you've given me thus far.

Will

Share this post


Link to post
Hi

Ultimately I would like to learn Vectorscript to improve our workflow and efficiency, however fitting it in around day to day work means progress is slow.

If you need the code anyway then I would really appreciate you sending it to me if you don't mind writing it. I am keen to see how it is done and to implement it into our way of working.

I really appreciate the help you've given me thus far.

Will

Here you go..

I've added a popup that shows which layers get compared on each turn, so you'll understand it better when changing the script to use your Layers.

The code now, loops from number Z="0" upto "+2". From that, it generates 2 layer names, the one with the spaceobjects on and the one with the symbols.

I use "niv Z WVB" as the spacelayer and "niv Z elektriciteit" as a layer with my symbols. Z being the changing number. Edit that so it works on your personal layers.

Don't forget to change the record and field name again.

In the comparison part, where I check the location of the symbol within a spaceobject I use the following code:

						IF (PtInPoly(x,y,PolyHandle[i])) AND (PtInPoly(x,y+1,PolyHandle[i])) AND (PtInPoly(x+1,y,PolyHandle[i])) AND (PtInPoly(x,y-1,PolyHandle[i])) AND (PtInPoly(x-1,y,PolyHandle[i])) THEN BEGIN

The way I draw, my spaceobjects overlap each other on wallparts, if that is not the case you should change that part into:

						IF (PtInPoly(x,y,PolyHandle[i]))THEN BEGIN

With this change, the symbols are "accepted" on the borderline of your spaceobject. The previous one will only accept symbols at least one unit further within the object.

Full script:

Procedure FindSymbols;
VAR
i,j,k,l,EmptySpaceCounter,SymbolCounter,SpaceCounter,Z:					INTEGER;
temp_string,defaultRecName,defaultFieldName,DBCrit,DBCrit2,SearchString,DBString:	STRING;
originPt:												POINT;
SpaceLayer,SymbolLayer	,SubLayer,s_Z,s_Result								:STRING;

ObjectHandle, PolyHandle:DYNARRAY [] OF HANDLE;
SpaceName: DYNARRAY [] OF STRING;
SpaceXOrigin,SpaceYOrigin: DYNARRAY [] OF REAL;

  	handleArrayCount,ArrayCounter :INTEGER;
  	handleArrayAlloc :INTEGER;


PROCEDURE GetSymbols(SymHandle:HANDLE);
VAR
	symPt:					POINT;
	SymbolName,recName:			STRING;
	x,y						:REAL;
BEGIN
	FOR j:=1 TO NumRecords(SymHandle) DO BEGIN
		recName := GetName(GetRecord(SymHandle, j));
		IF recName = defaultRecName THEN BEGIN
			SymbolName:=GetSymName(SymHandle);
			IF SymbolName <>'' THEN BEGIN
				GetSymLoc(SymHandle,symPt.x,symPt.y);
				FOR i:=1 TO handleArrayAlloc DO BEGIN
					x:=symPt.x-SpaceXOrigin[i];
					y:=symPt.y-SpaceYOrigin[i];
					IF (PtInPoly(x,y,PolyHandle[i])) AND (PtInPoly(x,y+1,PolyHandle[i])) AND (PtInPoly(x+1,y,PolyHandle[i])) AND (PtInPoly(x,y-1,PolyHandle[i])) AND (PtInPoly(x-1,y,PolyHandle[i])) THEN BEGIN
						{ Store location }
						SetRField(SymHandle,recName,defaultFieldName,SpaceName[i]);
						{AlrtDialog(concat(SymbolName,' IS FOUND IN ',SpaceName[i],' ON : x=',symPt.x,' y=',symPt.y));}
						SymbolCounter:=SymbolCounter+1;
					END;
				END;
			END;
		END;
	END;
END;

Procedure GetSpace(ObjHnd:HANDLE);
BEGIN
	{ Check for Handle to excist }
	ObjectHandle[ArrayCounter]:=ObjHnd;

	{ Handle Found, continue }
	IF ObjectHandle[ArrayCounter] <> NIL THEN BEGIN
		{ Get space info }
		IF GetRfield(ObjHnd,'TDE_Space','SpaceName2') <> '' THEN BEGIN
			SpaceName[ArrayCounter]:=GetRfield(ObjHnd,'TDE_Space','SpaceName2');
		END;
		IF (GetRfield(ObjHnd,'Space','Number') <> '') OR (GetRfield(ObjHnd,'Space','Name') <>'') THEN BEGIN
			IF  (GetRfield(ObjHnd,'Space','Number') <> '') AND (GetRfield(ObjHnd,'Space','Name') <>'') THEN BEGIN
				SpaceName[ArrayCounter]:=concat(GetRfield(ObjHnd,'Space','Number'),': ',GetRfield(ObjHnd,'Space','Name'));
			END
			ELSE IF GetRfield(ObjHnd,'Space','Number') <> '' THEN BEGIN
				SpaceName[ArrayCounter]:=GetRfield(ObjHnd,'Space','Number');
			END
			ELSE BEGIN
				SpaceName[ArrayCounter]:=GetRfield(ObjHnd,'Space','Name');
			END;
		END;

		{AlrtDialog(concat(SpaceName[ArrayCounter],'   '));}

		{ Get the path }
		PolyHandle[ArrayCounter]:=GetCustomObjectPath(ObjHnd);
		{ Get the space insertion point to correct the coordinates when comparing }
		GetSymLoc(ObjHnd,SpaceXOrigin[ArrayCounter], SpaceYOrigin[ArrayCounter]);
		IF SpaceName[ArrayCounter]='' THEN BEGIN
			EmptySpaceCounter:=EmptySpaceCounter+1;
		END
		ELSE BEGIN
			SpaceCounter:=SpaceCounter+1;
		END;
	END;
	ArrayCounter:=ArrayCounter+1;
END;
BEGIN
{ The record/field name of the used symbols }
defaultRecName:='TDE_00 algemeen';
defaultFieldName:='RuimteNaam';
SubLayer:='elektriciteit';

{ This loop will run the script for each layer, and its sub layer with symbols }
FOR Z:= 0 TO +2 DO BEGIN
	{ define the layer name for each level Z }
	IF Z > 0 THEN s_Z:=concat('+',Z) ELSE s_Z:=concat(Z); { add + on positive levels }
	SpaceLayer:=concat('niv ',s_Z,' WVB');
	SymbolLayer:=concat('niv ',s_Z,' ',SubLayer);

	s_Result:=concat(s_Result,SpaceLayer,' with ',SymbolLayer,chr(13));

	{ Get all space objects }
	DBCrit:=concat('(PON=',chr(39),'TDE_Space',chr(39),') & (L=',chr(39),SpaceLayer,chr(39),')'); { objects }
	DBCrit2:=concat('(T=SYMBOL) & (L=',chr(39),SymbolLayer,chr(39),')'); { symbols }

	handleArrayAlloc:=COUNT(DBCrit);

	{ we found spaceobjects in this layer AND symbols in the other, welllll let's continue }
	IF (handleArrayAlloc > 0) AND (COUNT(DBCrit2)>0) THEN BEGIN
		{ Define arrays }
		ALLOCATE ObjectHandle [1..handleArrayAlloc];
		ALLOCATE PolyHandle [1..handleArrayAlloc];
		ALLOCATE SpaceName [1..handleArrayAlloc];
		ALLOCATE SpaceXOrigin [1..handleArrayAlloc];
		ALLOCATE SpaceYOrigin [1..handleArrayAlloc];

		{ Loop trough each custom space object and store handles and general info in arrays }
		ArrayCounter:=1;	
		ForEachObject(GetSpace,DBCrit);

		{ Loop trough all the symbols once, for each layer and compare them with the stored space objects of that layer }
		ForEachObject(GetSymbols,DBCrit2);
	END;	
	{ end of loop, up to the next layers one level up}	
END;

AlrtDialog(concat('Symbols succescully named on layers:',chr(13),s_Result));
END;
Run(FindSymbols);

Edited by hippothamus

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×
×
  • Create New...