Jump to content
Developer Wiki and Function Reference Links Read more... ×
tismacfan2

drawing a cupboard

Recommended Posts

Posted (edited)

With my limited knowledge of Vectorscript, I tried to write a simple script for the sign of a low and high cupboard in floor plans. The intention is for the low cupboard to have a white filling and the high cupboard to have a dark gray filling. I want to get this by choosing the high or low cupboard in my info pallet. I manage to draw the low cupboard with white filling, but if I choose high cupboard, I only get a line and my cupboard disappears. Could someone help me make this script workable. If it is possible to give a height via the script, this would be a very nice extension for me. Thanks in advance for the help.

[P] kasten.vso

 

Procedure kast; 

VAR 
a,v,l:REAL; 
teller:REAL;
verdeling:boolean; 
tk:string;


BEGIN 

a:=pdiepte; 
v:=pv;
l:=Plinelength;
verdeling:=pverdeling;
tk:=ptk;

IF tk ='lage kast'THEN BEGIN
rect(0,0,l,a);
FillBack(0);
FillFore(257);
FillPat(1);
PenSize(4);
PenBack(256);
PenFore(257);
PenPatN(2);
DSelectAll;
IF verdeling THEN BEGIN
PenSize(1);PenBack(256);PenFore(257);PenPatN(-499);
teller:=1; 
line(0,a);
MoveObjs(v,0,FALSE,FALSE);

REPEAT
Duplicate(v,0); 
teller:=teller+1; 
UNTIL ((v*teller)>l-v); 
end

ELSE IF tk ='hoge kast'THEN BEGIN
rect(0,0,l,a);
FillBack(1238);
FillFore(257);
FillPat(1);
PenSize(4);
PenBack(256);
PenFore(257);
PenPatN(2);

DSelectAll;
IF verdeling THEN BEGIN
PenSize(1);PenBack(256);PenFore(257);PenPatN(-499);
teller:=1; 
line(0,a);
MoveObjs(v,0,FALSE,FALSE);

REPEAT


Duplicate(v,0); 
teller:=teller+1; 
UNTIL ((v*teller)>l-v); 
end

 


END; 
end;
end;

Run (kast); 

Edited by tismacfan2

Share this post


Link to post

You seem to be displaying fill pattern 1 which is the foreground but changing the background colour.

Try setting it to fill pattern 2 or changing the fill foreground colour.

Also using PushAttrs and PopAttrs for storing and resetting the current attributes is a good habit.

 

If you extrude your rectangle it will have height and be 3d, after which it can be moved with the move3d procedure.

You could also switch the plane mode to working plane before drawing the rectangle, after which move3d should work on the rectangle. just remember to return it to its previous setting. If you simply want to know the cabinet elevation in plan view, simply create another parameter for displaying in the object info palette.

Share this post


Link to post

Could you not help me by adjusting the script according to your comments please. What I don't really understand much about it. Thanks in advance

Share this post


Link to post

See if this works for you.

 

Procedure kast; 

VAR 
a,v,l:REAL; 
teller:REAL;
verdeling:boolean; 
tk:string;


BEGIN 

a:=pdiepte; 
v:=pv;
l:=Plinelength;
verdeling:=pverdeling;
tk:=ptk;

IF tk ='lage kast'THEN BEGIN
rect(0,0,l,a);
FillBack(0);
FillFore(257);
FillPat(2); {change made here}
PenSize(4);
PenBack(256);
PenFore(257);
PenPatN(2);
DSelectAll;
IF verdeling THEN BEGIN
PenSize(1);PenBack(256);PenFore(257);PenPatN(-499);
teller:=1; 
line(0,a);
MoveObjs(v,0,FALSE,FALSE);

REPEAT
Duplicate(v,0); 
teller:=teller+1; 
UNTIL ((v*teller)>l-v); 
end

ELSE IF tk ='hoge kast'THEN BEGIN
rect(0,0,l,a);
FillBack(1238); {I did not check to see if this value is in range}
FillFore(257);
FillPat(2); {change made here}
PenSize(4);
PenBack(256);
PenFore(257);
PenPatN(2);

DSelectAll;

IF verdeling THEN BEGIN
PenSize(1);PenBack(256);PenFore(257);PenPatN(-499);
teller:=1; 
line(0,a);
MoveObjs(v,0,FALSE,FALSE);

REPEAT


Duplicate(v,0); 
teller:=teller+1; 
UNTIL ((v*teller)>l-v); 
end

 


END; 
end;
end;

Run (kast); 

Share this post


Link to post


Thanks in advance for the effort, but even now I get the same with low cabinet I get it correct, but with high cabinet I only get to see a line but when I deselect I see nothing anymore. When I change back to a low cupboard, I see what I want in the right color.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

 

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.

×