Jump to content

Display coords given handle


Recommended Posts

Hello all,

 

Long time VWX user, first time VS user..."not-a-programmer-boilerplate-intro.docx" I'm working on a custom seating tool and have run into what should be an elementary issue.  I've written code to run various maths on a selected rectangle giving me numbers for what will eventually be a semi-parametric tool, but in order to get to the next step - I to find the X,Y coordinates of a previously selected rectangle via the known HANDLE. I see plenty of ways to do the opposite action...

 

I'm attaching my full code, but it's just under the BEGIN statement where I would expect to insert a Getcoord(h) or something.

I understand that my structure is not orthodox but it does compile and function thus-far. 

 

Thanks!

 

{-=x=-=x=-=x=-=x=-=x=-=x=-=x=-=x=-=x=-=x=-=x=-=x=-=x=-=x=-=x=--=x=-=x=-=x=-=x=-=x=-=x=-=x=-=x=-=x=-=x=-=x=-=x=-=x=-=x=-=x=-
	ASBESTOS - A BETTER SEATING TOOL
			BETA_V.005
		
-=x=-=x=-=x=-=x=-=x=-=x=-=x=-=x=-=x=-=x=-=x=-=x=-=x=-=x=-=x=--=x=-=x=-=x=-=x=-=x=-=x=-=x=-=x=-=x=-=x=-=x=-=x=-=x=-=x=-=x=-}

Procedure ABST;

CONST
(*these vars will eventually be user/parametric inputs*)
CHAIRLENGTH=17;
CHAIRWIDTH=20;
CHAIRSPACE=2;
CHAIRSROW=14;
(*CHAIRSROWMIN=foo; *)
MAXROW=15;
(*MINROW=bar;*)
ROWSPACE=30; {is +6" of chairtool spacing}
AISLE=96;


(*Sub-constants for use in calculations*)

LIVIX=(CHAIRLENGTH*CHAIRSROW);
LIVOX=(CHAIRSROW-1);
VORIX=(CHAIRWIDTH*MAXROW);
VOROX=(MAXROW-2);
HZ_DIVISOR= (LIVIX)+(CHAIRSPACE*LIVOX)+(AISLE/2);
VR_DIVISOR=(VORIX)+(ROWSPACE*VOROX)+(AISLE/2);
SUBSECLEN= ((LIVIX)+(CHAIRSPACE*LIVOX));
SUBSECWID= Trunc((VORIX)+(ROWSPACE*VOROX));


{<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>}


(*these variable definitions are utilized within native VS functions*)
VAR
h 		:HANDLE;



(*these variable definitions are utilized within local functions*)

VERT : REAL;
HORZ : REAL;
LENGDIV: REAL;
TRUSECLEN: REAL; 
TRUSECWID: REAL;
NUMHORZSEC: REAL;
NUMVERTSEC: REAL;


BEGIN
{these are calls to the VWX API funtions and serve to assign numerical value to the vars seen above}

h:= FSACTLAYER;
VERT:= HHeight(h);
HORZ:= HWidth(h);
{!!!}



{at this point, boundary height and length have been 
defined and stored in the VERT and HORZ variables} 

{<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>}

{this determines the boundry size of each seating section WITH AISLES}

TRUSECLEN:= Trunc(HZ_DIVISOR);
TRUSECWID:= Trunc(VR_DIVISOR);

{As reference, the constants SUBSECLEN and SUBSECWID determine the boundry size of each seating section WITHOUT AISLES}

{<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>}

{this divides the outer boundary by true calculated section size}

NUMHORZSEC:= Trunc(HORZ/HZ_DIVISOR);
NUMVERTSEC:= Trunc(VERT/VR_DIVISOR);

	Message('TOTAL HORZ SECTIONS:', NUMHORZSEC, 'TOTAL VERT SECTIONS', NUMVERTSEC);
	END;

Run(ABST);

 

Link to comment

For rectangles and other objects you can use GetBBox (Get Bounding Box) to get the coordinates of the bounding box.  


GetSymLoc will return the insertion point of a symbol or PIO.

 

But before you go much further, perhaps @michaelk can show you his seating tool and see if it is adequate for your needs.

Link to comment

My tool uses symbols that can be globally changed per row or each seat can use a separate symbol. It uses separate symbols for arms, so that there aren't two arms between seats.  The tool will create all the default symbols the first time it runs but you can use any symbol you want.

 

Your script uses a fixed seat-to-seat distance.  TheateRow will use either a parametric distance like yours or let you set the number of seats in the row and it will figure out the distance.

 

Just draw a path from HL to HR with any type of vertices you need and double click to end the path.  TheateRow uses some sneaky vector math (Hi @MullinRJ!) to place the seat symbols, the interior arm symbols, and the HL and HR arm symbols.  Then has settings for the offset from the path.

 

If you need to specify seats that are accessible or blocked you can "manage" the symbol of each seat in the row.

 

I needed this tool so badly that I spent years bugging @PatStanford, @MullinRJ, and @Sam Jones until I learned enough to slog through it 🙂 

Link to comment

Thanks Michael et al. 

 

I'm going to take a look at your tool in a minute - These days I'm drafting mostly seating layouts for conference halls. Unfortunately from your description it sounds like yours is geared toward traditional theatre seating, or slot-lock style chairs (read zip-tie) . We tend to use what I would colloquially describe as music chairs, as our symbols anyway. Nonetheless I'm eager to try it out TheateRow and perhaps dissect it a bit. 

 

I was in the middle of trying to use HCenter() when Pat replied. 

 

This project started in marionette and quickly got out of hand. Once it exceeded 25 or so nodes, I found that I couldn't make sense of it if I stepped away for even a minute. 

I'm sure I'll have more questions or want to show off my monkey on a typewriter coding skills. I'll keep you all updated.

 

KM

Link to comment
13 minutes ago, kmin91 said:

I'm going to take a look at your tool in a minute - These days I'm drafting mostly seating layouts for conference halls. Unfortunately from your description it sounds like yours is geared toward traditional theatre seating, or slot-lock style chairs (read zip-tie) . We tend to use what I would colloquially describe as music chairs, as our symbols anyway. Nonetheless I'm eager to try it out TheateRow and perhaps dissect it a bit. 

 

Let me know if I can help you with it.  You can use your own chair symbols.  And you can use the split tool to cut aisles.

 

But it might be more fun to write your own 🙂 

Link to comment

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.

×
×
  • Create New...