Setting and getting level properties


Your Ad Here


Topsolid online Help Index

This example shows how to set level properties.

 

Dim TopApp As TopSolid.Application

 

...

 

Dim TopDoc As TopSolid.Document

Dim levelsname(3) As Long

Dim group1(2) As Long

Dim group2(2) As String

 

Dim states As

Dim name As String

Dim groupname As String

 

' set name to levels

 

TopDoc.SetLevelProperty topName, 10, "level10"

TopDoc.SetLevelProperty topName, 11, "level11"

TopDoc.SetLevelProperty topName, 12, "level12"

TopDoc.SetLevelProperty topName, 13, "level13"

 

TopDoc.SetLevelProperty topName, 20, "level20"

TopDoc.SetLevelProperty topName, 21, "level21"

TopDoc.SetLevelProperty topName, 22, "level22"

 

 

' set an array of level names

 

levelsname(0) = "level10"

levelsname(1) = "level11"

levelsname(2) = "level12"

levelsname(3) = "level13"

 

 

' set an array of level indexes

 

group1(0) = 5

group1(1) = 6

group1(2) = 7

 

 

' set another array of level names

group2(0) = "level20"

group2(1) = "level21"

group2(2) = "level22"

 

 

' enable levels

 

TopDoc.SetLevelsPropertyByName topEnable, levelsname

 

 

' group levels and name it

 

TopDoc.SetLevelsProperty topGroup, group1, "Groupe 1"

 

TopDoc.SetLevelsProperty topGroup, group2, "Groupe 2"

 

 

' freeze the group "Groupe 1"

 

TopDoc.SetLevelPropertyByName topFreeze, "Groupe 1"

 

 

'active and freeze "Groupe 2"

 

TopDoc.SetLevelPropertyByName topEnable, "Groupe 2"

TopDoc.SetLevelPropertyByName topFreeze, "Groupe 2"

 

 

' get the properties of the level 5

 

TopDoc.GetLevelProperties 5, states, name, groupname

' the result is :

'    . states(0) = False (the level is not active)

'    . states(1) = True (the level is frozen)

'    . states(2) = True (the level is in a group)

'    . name = "" (the level doesn't have name)

'    . groupname = "Groupe 1"

 

 

' get the properties of "level12"

 

TopDoc.GetLevelPropertiesByName "level12", states, name, groupname

' the result is :

'    . states(0) = True (the level is active)

'    . states(1) = False (the level is not frozen)

'    . states(2) = False (the level is not in a group)

'    . states(3) = False (it's not a group)

'    . name = "level12"

'    . groupname = ""

 

 

' get the properties of the level 20

 

TopDoc.GetLevelProperties 20, states, name, groupname

' the result is :

'    . states(0) = True (the level is active)

'    . states(1) = True (the level is frozen)

'    . states(2) = True (the level is in a group)

'    . states(3) = False (it's not a group)

'    . name = "level20"

'    . groupname = "Groupe 2" (the level 20 is in the group "Groupe 2")

 

 

 

 

 

...

Set Top

Topsolid online Help Index

Your Ad Here