Views:

Question

How can I export only active network elements (only active links) as shapefile?

Answer

Use an object of the class IExportShapeFilePara, and set the attribute OnlyActive:
myExportShapeFileParameterObject.AttValue('ONLYACTIVE') = 1

 

Example for Python:

import os

cMyVersionFileIn = r"c:\Users\Public\Documents\PTV Vision\PTV Visum 2025\Example_net\EXAMPLE.VER"
cMyLinkFilter = os.path.expanduser("~") + r"\Downloads\aLinkFilter.fil"   # From the attached zip file.
cMyShpFileOut = os.path.expanduser("~") + r"\Downloads\ActiveLinks.shp"   # This is the file to be written.

Visum.Filters.Open(cMyLinkFilter)
myExportShapeFileParameterObject = Visum.IO.CreateExportShapeFilePara()
myExportShapeFileParameterObject.ObjectType = 0     # shapefileTypeLinks
myExportShapeFileParameterObject.SetAttValue("ONLYACTIVE", 1)
myExportShapeFileParameterObject.AddKeyColumns()
myExportShapeFileParameterObject.AddColumn("NAME")
myExportShapeFileParameterObject.AddColumn("TYPENO")
Visum.IO.ExportShapefile(cMyShpFileOut, myExportShapeFileParameterObject)

 

Code example as VBA and with the used filter file aLinkFilter.fil attached.

Related Attachments (1)