PTV Visum - API/COM
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"…
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.
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…
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…
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 =…
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…
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') =…
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…
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…
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)
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)
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 =…
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 =…
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 =…
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 =…
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 =…
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…
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…
