Python AddIns cannot be started: "No valid scripting environment is defined for the AddIn .."/"No suitable installation of Python 3.9 was found"

Symptom - PTV Visum was unable to find a suitable Python 2.7/3.7/3.9 installation.- Python 2.7 and/or 3.7/3.9 is listed as "not available" in the "User Preferences"…

Export: Write matrices as CSV file

Question How to write matrices from Visum into a CSV-file, like:0,200,999234,454,2331212,55,33.12 Answer See the attached example.  

Create a flow bundle (PrT/PuT) and display as a PuT path list by using COM

Question How to create a flow bundle (PrT/PuT) and read out as a PuT path list by using COM? Answer 1) Create a flow bundle:Set aStopPoint = Visum.Net.StopPoints.ItemByKey(30)Set…

How to execute a PrT shortest path search by COM?

Question How to execute a PrT shortest path search by COM? Answer An example for a shortest path search between two nodes:Set NetElementContainer = Visum.CreateNetElementsSet Node = Visum.Net.Nodes.ItemByKey(10)NetElementContainer.Add…

How to execute a PuT shortest path search by COM?

Question How to execute a PuT shortest path search by COM? Answer Use a RouteSearchPuT Object, that is given a NetElements container with network elements. An example:   aNetElementContainer =…

COM/VBA: Set header/footer/print to PDF

Question How can I set a header and footer and print the network editor to PDF by COM? Answer - Use the class Visum.Net.PrintParameters.PrintFrame.Footer:Example code:Dim myPrintFrameFooter As VISUMLIB.IPrintFrameFooterDim…

COM/Export/Shape file: Only active network elements/IExportShapeFilePara

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') =…

Documentation on the Visum COM API

Question Where can I find documentation on the Visum COM API? Answer 1) You can find an introduction to scripting with the Visum COM API in Help -> Introduction…

COM/Python: Autocompletion

Symptom Python code completion does not work in PyCrust and in PTV Visum menu 'Scripts->VisumAddIn->Python Console'.Only commands beginning with '_' are shown.Error message contains "gencache.py", like…

COM: Create a simple Flow bundle for PrT

Question How to create a flow bundle based upon a PrT assignment by using COM? Answer Example: aFlowBundlePrT = Visum.Net.FlowBundleaFlowBundlePrT.Clear()aFlowBundlePrT.DemandSegments = "C"aNetElmsPrT = Visum.CreateNetElements()aNetElmsPrT.Add(Visum.Net.Nodes.ItemByKey(159))aFlowBundlePrT.Execute(aNetElmsPrT)

COM: Create a simple Flow bundle for PuT

Question How to create a flow bundle based upon a PuT assignment by using COM? Answer Example: aFlowBundlePuT = Visum.Net.FlowBundleaFlowBundlePuT.Clear()aFlowBundlePuT.DemandSegments = "PT"aNetElmsPuT = Visum.CreateNetElements()aNetElmsPuT.Add(Visum.Net.StopPoints.ItemByKey(66))aFlowBundlePuT.Execute(aNetElmsPuT)

COM: Create a Flow bundle for PrT with multiple AND-linked conditions

Question How to create a flow bundle based upon a PrT assignment by using COM, using multiple conditions, linked by "AND"? Answer Example: aFlowBundlePrT = Visum.Net.FlowBundleaFlowBundlePrT.Clear()aFlowBundlePrT.DemandSegments = "C"aNetElmsPrT =…

COM: Create a Flow bundle for PuT with multiple AND-linked conditions

Question How to create a flow bundle based upon a PrT assignment by using COM, using multiple conditions, linked by "AND"? Answer Example: aFlowBundlePuT = Visum.Net.FlowBundleaFlowBundlePuT.Clear()aFlowBundlePuT.DemandSegments = "PT"aNetElmsPuT =…

COM: Create a Flow bundle for PrT with multiple OR-linked conditions

QuestionHow to create a flow bundle based upon a PrT assignment by using COM, using multiple conditions, linked by "OR"?AnswerExample: aFlowBundlePrT = Visum.Net.FlowBundleaFlowBundlePrT.Clear()aFlowBundlePrT.DemandSegments = "C" aNode1 =…

COM: Create a Flow bundle for PuT with multiple OR-linked conditions

Question How to create a flow bundle based upon a PuT assignment by using COM, using multiple conditions, linked by "OR"? Answer Example: aFlowBundlePuT = Visum.Net.FlowBundleaFlowBundlePuT.Clear()aFlowBundlePuT.DemandSegments = "PT"aStopPoint1 =…

COM: Create a Flow bundle for PuT with restricted supply

QuestionHow to create a flow bundle based upon a PuT assignment by using COM, using conditions restricting ?AnswerExample: aFlowBundlePuT = Visum.Net.FlowBundleaFlowBundlePuT.Clear()aFlowBundlePuT.DemandSegments = "PT" aStopPoint1 = Visum.Net.StopPoints.ItemByKey(442)aStopPoint2 =…

COM: Create a Flow bundle for PrT with an excluding condition

QuestionHow to create a flow bundle based upon a PrT assignment by using COM, using multiple conditions, some include, some exclude network elements?AnswerExample: aFlowBundlePrT = Visum.Net.FlowBundleaFlowBundlePrT.Clear()aFlowBundlePrT.DemandSegments…

COM: Create a Flow bundle for PrT for a set of active links

Question How to create a flow bundle by using COM, based upon a PrT assignment, for a set of active links? Answer Example:   aFlowBundlePrT = Visum.Net.DemandSegments.ItemByKey("C").FlowBundleaTTSet = aFlowBundlePrT.CreateRouteTrafficTypeSet()aTTSet.Add(8) # Through…