ConfigureScript in On run

PLS teach me about this error

Hy,

I think outpath is not defined… :wink:

Can you show where is outpath declared??

Regards
Feature

Is this File??

Hy,

in the Python-Script.

Regards
Feature

from vcScript import *
import vcMatrix
finalizing = True

def OnRun():
global outPath

s = comp.findBehaviour(“BatchSignal”)
BatchReadySignal = comp.findBehaviour(“BatchReadySignal”)
StartStop = comp.findBehaviour(“StartStop”)
Post_Batch_Task = comp.getProperty(“PostBatchTask”)

#if Post_Batch_Task.Value == “ReleaseBatchDownstream”:
#comp.PackBatchToOneComponent = True

while True:
triggerCondition(lambda: getTrigger() == s and s.Value)
p = s.Value
if Post_Batch_Task.Value == “DeleteFinishedBatch”:
comp.findBehaviour(“One-WayPath__HIDE__”).Enabled = False
delay(1)
p.delete()
comp.findBehaviour(“One-WayPath__HIDE__”).Enabled = True
if Post_Batch_Task.Value == “BatchSignalToRobot”:
comp.findBehaviour(“One-WayPath__HIDE__”).Enabled = False
BatchReadySignal.signal( True )
triggerCondition(lambda: getTrigger() == StartStop and StartStop.Value == True)
comp.findBehaviour(“One-WayPath__HIDE__”).Enabled = True
BatchReadySignal.signal( False )
if Post_Batch_Task.Value == “ReleaseBatchDownstream”:
delay(0.001)
comp.findBehaviour(“One-WayPath__HIDE__”).Enabled = False
if outPath :
outPath.grab§
delay(comp.BatchReleaseTime)
comp.findBehaviour(“One-WayPath__HIDE__”).Enabled = True
else:
print “no conveyor connected downstream!”

def OnFinalize():
global finalizing
finalizing = False

def typechange(args):
comp = getComponent()
comp.findBehaviour(“One-WayPath__HIDE__”).Speed = comp.getProperty(“ConveyorSpeed”).Value
comp.findBehaviour(“One-WayPath__HIDE__”).Capacity = comp.getProperty(“ConveyorCapacity”).Value

def OnUserGeometrySet(var):
gf = comp.getFeature(‘CustomUserGeometry’)
gf.Uri = var.Value
ssw = comp.getFeature(‘VCGeometryVsUserGeometry’)
ssw.Choice = ‘1’
if not gf.Geometry.GeometrySetCount:
gf.Uri = ‘’
comp.getProperty(‘UserGeometry::GeometryFile’).Value = ‘’
print ‘WARNING from’, comp.Name,’ Invalid geometry file set as UserGeometry.’
ssw.Choice = ‘2’
comp.rebuild()

Try to take the props from the preceding conveyor

def unifyProps(otherIface, offset):
global finalizing, speed, cWidth, cHeight, comp
if not finalizing and comp.AutomaticParametersEnabled:
cWidth.ChangeOnRebuild = False
cHeight.ChangeOnRebuild = False
speed.ChangeOnRebuild = False
cType.ChangeOnRebuild = False
rollRad.ChangeOnRebuild = False
rollDist.ChangeOnRebuild = False
sWeight.ChangeOnRebuild = False
if otherIface.Component.getProperty(“ConveyorWidth”):
cWidth.Value = otherIface.Component.getProperty(“ConveyorWidth”).Value
oldHeight = comp.ConveyorHeight
if otherIface.Component.getProperty(“ConveyorHeight”):
cHeight.Value = otherIface.Component.getProperty(“ConveyorHeight”).Value
if otherIface.Component.getProperty(“ConveyorSpeed”):
speed.Value = otherIface.Component.getProperty(“ConveyorSpeed”).Value
if otherIface.Component.getProperty(“ConveyorType”):
cType.Value = otherIface.Component.getProperty(“ConveyorType”).Value
if otherIface.Component.getProperty(“RollRadius”):
rollRad.Value = otherIface.Component.getProperty(“RollRadius”).Value
if otherIface.Component.getProperty(“RollDistance”):
rollDist.Value = otherIface.Component.getProperty(“RollDistance”).Value
if otherIface.Component.getProperty(“StructureWeight”):
sWeight.Value = otherIface.Component.getProperty(“StructureWeight”).Value
mtx = vcMatrix.new(comp.PositionMatrix)
mtx.translateRel(0,0,oldHeight-comp.ConveyorHeight)
comp.PositionMatrix = mtx
comp.Material = otherIface.Component.Material
cWidth.ChangeOnRebuild = True
cHeight.ChangeOnRebuild = True
speed.ChangeOnRebuild = True
cType.ChangeOnRebuild = True
rollRad.ChangeOnRebuild = True
rollDist.ChangeOnRebuild = True
sWeight.ChangeOnRebuild = True
comp.rebuild()

def connectPreceedingConveyor(otherIface, offset):
global outPath
outPath = otherIface.Component.findBehavioursByType(VC_ONEWAYPATH)[0]

def disconnectPreceedingConveyor(otherIface):
global outPath
outPath = None

comp = getComponent()
path = comp.findBehaviour(‘One-WayPath__HIDE__’)
sWeight = comp.getProperty(“StructureWeight”)
rollRad = comp.getProperty(“RollRadius”)
rollDist = comp.getProperty(“RollDistance”)
cType = comp.getProperty(“ConveyorType”)
cWidth = comp.getProperty(“ConveyorWidth”)
cHeight = comp.getProperty(“ConveyorHeight”)
speed = comp.getProperty(“ConveyorSpeed”)
speed.OnChanged = typechange

cap = comp.getProperty(“ConveyorCapacity”)
cap.OnChanged = typechange

ugVar = comp.getProperty(‘UserGeometry::GeometryFile’)
ugVar.OnChanged = OnUserGeometrySet

inIface = comp.findBehaviour(‘InInterface’)
inIface.OnConnect = unifyProps

outIface = comp.findBehaviour(‘OutInterface’)
outIface.OnConnect = connectPreceedingConveyor
outIface.OnUnConnect = disconnectPreceedingConveyor

Hy,

maybe try something like:

Regards
Feature

Maybe Fix But another Error

Hy,

I think there is no conveyor connected? :wink: -> Will you post every Error in your Python-Script? -> Have you tried to find the mistake on your own?

Regards
Feature

1 Like

def OnRun():
global outPath

s = comp.findBehaviour(“BatchSignal”)
BatchReadySignal = comp.findBehaviour(“BatchReadySignal”)
StartStop = comp.findBehaviour(“StartStop”)
Post_Batch_Task = comp.getProperty(“PostBatchTask”)

#if Post_Batch_Task.Value == “ReleaseBatchDownstream”:
#comp.PackBatchToOneComponent = True

while True:
triggerCondition(lambda: getTrigger() == s and s.Value)
p = s.Value
if Post_Batch_Task.Value == “DeleteFinishedBatch”:
comp.findBehaviour(“One-WayPath__HIDE__”).Enabled = False
delay(1)
p.delete()
comp.findBehaviour(“One-WayPath__HIDE__”).Enabled = True
if Post_Batch_Task.Value == “BatchSignalToRobot”:
comp.findBehaviour(“One-WayPath__HIDE__”).Enabled = False
BatchReadySignal.signal( True )
triggerCondition(lambda: getTrigger() == StartStop and StartStop.Value == True)
comp.findBehaviour(“One-WayPath__HIDE__”).Enabled = True
BatchReadySignal.signal( False )
if Post_Batch_Task.Value == “ReleaseBatchDownstream”:
delay(0.001)
comp.findBehaviour(“One-WayPath__HIDE__”).Enabled = False
if outPath :
outPath.grab§
delay(comp.BatchReleaseTime)
comp.findBehaviour(“One-WayPath__HIDE__”).Enabled = True
else:
print “no conveyor connected downstream!”

I think you got an answer Feature :smiley:

Hy,

I like it when people try to solve their Problems and came Up with specific questions… :wink:

Regards
Feature