Difference between revisions of "VS:SetStoryElevation"

From Vectorworks Developer
Jump to: navigation, search
(add infos and example)
 
Line 40: Line 40:
  
 
-----------------------------------------------------------------------------------------------------------
 
-----------------------------------------------------------------------------------------------------------
<remark>([[User:Orso.b.schmid|Orso]], 2018.10.23): SetStoryElevations wants mm and needs the story to have an associated design layer, or it will fail.
+
<remark>([[User:Orso.b.schmid|Orso]], 2018.10.23): SetStoryElevations wants mm. It needs the story to have an associated design layer with [[VS:AssociateLayerWithStory]], or it will fail, while AssociateLayerWithStory needs the layer to be linked to a level with [[VS:SetLayerLevelType]] or it will fail. In the example below you have the sequence to make that work.
  
 
<code lang="pas">
 
<code lang="pas">
 
{ Orso }
 
{ Orso }
 +
 
PROCEDURE TEST;
 
PROCEDURE TEST;
 
VAR
 
VAR
Line 61: Line 62:
 
 
 
storyH := GetObject(storyN);
 
storyH := GetObject(storyN);
layerN := Concat('ABCD-', i, '-OG');
+
IF storyH <> NIL THEN BEGIN
layerH := CreateLayer(layerN, 1);
+
layerN := Concat('ABCD-', i, '-OG');
 +
layerH := CreateLayer(layerN, 1);
  
IF storyH <> NIL THEN BEGIN
 
 
 
IF layerH <> NIL THEN BEGIN
 
IF layerH <> NIL THEN BEGIN
 
IF SetLayerLevelType(layerH, 'OKF') = FALSE THEN
 
IF SetLayerLevelType(layerH, 'OKF') = FALSE THEN
AlrtDialog(Concat(layerN, ': SetLayerLevelType failed'));
+
AlrtDialog(Concat(layerN, ': SetLayerLevelType failed'))
+
IF AssociateLayerWithStory(layerH, storyH) = FALSE THEN
+
AlrtDialog(Concat(layerN, ': AssociateLayerWithStory failed'));
+
 
 
{ keep below associating the layer to the story }
+
{ fails if the layer is not linked to a level }
IF SetStoryElevation(storyH, baseElev) = FALSE THEN { always mm }
+
ELSE IF AssociateLayerWithStory(layerH, storyH) = FALSE THEN
AlrtDialog(Concat(storyN, ': SetStoryElevation failed'));
+
AlrtDialog(Concat(layerN, ': AssociateLayerWithStory failed'))
 +
 +
{ fails if the story is not associated to a layer }
 +
ELSE IF SetStoryElevation(storyH, baseElev) = FALSE THEN { always mm }
 +
AlrtDialog(Concat(storyN, ': SetStoryElevation failed'));
 +
END;
 
 
END ELSE
 
AlrtDialog(Concat(layerN, 'layer is NIL'));
 
 
 
baseElev := baseElev +3000mm;
 
baseElev := baseElev +3000mm;
 
END;
 
END;

Latest revision as of 01:08, 23 October 2018

.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix


Description

Sets the elevation of the indicated Story. Returns whether the elevation was successfully set. If the elevaton change would cause Layers associated with the Story to overlap Layers associated with another Story, then the change in elevation will be prevented.
FUNCTION SetStoryElevation(
story  :HANDLE;
elevation  :REAL) : BOOLEAN;
def vs.SetStoryElevation(story, elevation):
    return BOOLEAN

Parameters

story HANDLE The Story whose elevation is to be set.
elevation REAL The elevation to set the Story to.

Return Value

Whether the elevation is successfully changed.

Remarks

(Orso, 2018.10.23): SetStoryElevations wants mm. It needs the story to have an associated design layer with VS:AssociateLayerWithStory, or it will fail, while AssociateLayerWithStory needs the layer to be linked to a level with VS:SetLayerLevelType or it will fail. In the example below you have the sequence to make that work.
{ Orso }

PROCEDURE TEST;
VAR
	storyH, layerH : HANDLE;
	baseElev : REAL;
	storyN, layerN : STRING;
	i : INTEGER;
	
BEGIN
	baseElev := 0mm;
	
	FOR i:=1 TO 3 DO BEGIN
		storyN := Concat('Story-', i);
		
		IF CreateStory(storyN, Concat('ABCD-', i)) = FALSE THEN
			AlrtDialog(Concat(storyN, ' Story creation failed'));
		
		storyH := GetObject(storyN);
		IF storyH <> NIL THEN BEGIN
			layerN := Concat('ABCD-', i, '-OG');
			layerH := CreateLayer(layerN, 1);

			IF layerH <> NIL THEN BEGIN
				IF SetLayerLevelType(layerH, 'OKF') = FALSE THEN
					AlrtDialog(Concat(layerN, ': SetLayerLevelType failed'))
				
				{ fails if the layer is not linked to a level }
				ELSE IF AssociateLayerWithStory(layerH, storyH) = FALSE THEN
						AlrtDialog(Concat(layerN, ': AssociateLayerWithStory failed'))
					
					{ fails if the story is not associated to a layer }
					ELSE IF SetStoryElevation(storyH, baseElev) = FALSE THEN { always mm }
						AlrtDialog(Concat(storyN, ': SetStoryElevation failed'));
			END;
			
			baseElev := baseElev +3000mm;
		END;
	END;
END;
RUN(TEST);

Version

Availability: from Vectorworks 2012

See Also

VS Functions:

VS:CreateStory | VS:GetStoryElevation

VS Functions:

[[VS:CreateStory]]

| [[VS:GetStoryElevation]]
Personal tools
NamespacesFFFF

Variants
Actions
Advanced Search
See Also
Navigation
Toolbox