Jump to content
Developer Wiki and Function Reference Links ×

Scripting stories


_c_

Recommended Posts

Hello,

 

I finally made a manager for stories for transferring story data across documents.

There are a few relevant limits, but it is roughly possible to get a decent command doing the bulk of the job.

 

A couple of things are not clear to me: Does anybody know if there is a difference between these two?

* VW 17 (2013): GetStoryLayerInfo(index: INTEGER; VAR name: STRING; VAR scaleFactor: REAL; VAR layerLevelType : STRING; VAR elevationOffset: REAL; VAR defaultWallHeight: REAL): BOOLEAN;

* VW 20 (2015): GetLevelTemplateInfo(index: INTEGER; VAR layerName: STRING; VAR scaleFactor: REAL; VAR levelType: STRING; VAR elevation: REAL; VAR wallHeight: REAL): BOOLEAN;

 

I don't see any difference, and I tested really extensively. But, as always, I might be missing the obvious.

🙂

 

Does anyone know how to check if the suffix is actually used as a prefix?

 

Thank you,

Orso

Link to comment
  • 3 years later...

Should have searched, found this little nugget from @Pat Stanford

  

On 1/24/2020 at 8:12 AM, Pat Stanford said:

3. It is possible that under the current state of Vectorscript/VW2020 that we can not make a 100% accurate report. Is a mostly accurate report worth anything?  There is no way to query a storey and find out the levels that are associated. What I am doing now is making a list of all of the level types in the file and trying to assign each one to the story. If it succeeds then I assume that that level was not associated and delete it. If is fails, then I am assuming that the level already exists and adding it to the spreadsheet. Unfortunately, the way you add a level is by specifing the name of the level type. In your example above with two levels named Ceiling, I don't have a way to identify them separately.

 

code below:

## LEVELS
def get_all_level_types_in_document():
    doc_level_types = vs.GetNumLayerLevelTypes()
    level_type_names = []
    for i in range(doc_level_types):
        level_type_name = vs.GetLevelTypeName(i+1)
        level_type_names.append(level_type_name)

    return level_type_names

## GET LEVELS ASSOCIATED WITH A STORY
def stories_level_elevations(story_name:str):
    data = []
    doc_level_types = get_all_level_types_in_document()
    story_handle = vs.GetObject(story_name)
    
    for level_type in doc_level_types:
        elev = vs.GetLevelElevation(story_handle,level_type)
        result = vs.AddStoryLevel(story_handle, level_type, -123, '') # DUMMY LEVEL ASSOCIATION
        
        if result: # result is true if level not associated with Story, therefore we delete this temp association
            vs.RemoveStoryLevel(story_handle, level_type, False)
        else:
            data.append(f"Level Type {level_type}, Elevation : {elev}")

    return data

stories_level_elevations("L2")

 

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...