MCPcopy Create free account
hub / github.com/Kitware/ParaView / create

Method create

Web/Python/paraview/web/protocols.py:3140–3201  ·  view source on GitHub ↗

Creates a new filter/source proxy as a child of the specified parent proxy. Returns the proxy state for the newly created proxy as a JSON object.

(
        self,
        functionName,
        parentId,
        initialValues={},
        skipDomain=False,
        subProxyValues={},
    )

Source from the content-addressed store, hash-verified

3138
3139 @exportRpc("pv.proxy.manager.create")
3140 def create(
3141 self,
3142 functionName,
3143 parentId,
3144 initialValues={},
3145 skipDomain=False,
3146 subProxyValues={},
3147 ):
3148 """
3149 Creates a new filter/source proxy as a child of the specified
3150 parent proxy. Returns the proxy state for the newly created
3151 proxy as a JSON object.
3152 """
3153 name = self.validate(functionName)
3154
3155 if not name:
3156 return {
3157 "success": False,
3158 "reason": '"'
3159 + functionName
3160 + '" was not valid and could not be evaluated',
3161 }
3162
3163 pid = parentId
3164 parentProxy = self.mapIdToProxy(parentId)
3165 if parentProxy:
3166 simple.SetActiveSource(parentProxy)
3167 else:
3168 pid = "0"
3169
3170 # Create new source/filter
3171 sanitizedInitialValues = sanitizeKeys(initialValues)
3172 allowed = self.allowedProxies[name]
3173 newProxy = paraview.simple.__dict__[allowed](**sanitizedInitialValues)
3174
3175 # Update subproxy values
3176 if newProxy:
3177 for subProxyName in subProxyValues:
3178 subProxy = newProxy.GetProperty(subProxyName).GetData()
3179 if subProxy:
3180 for propName in subProxyValues[subProxyName]:
3181 prop = subProxy.SMProxy.GetProperty(propName)
3182 value = subProxyValues[subProxyName][propName]
3183 if isinstance(value, list):
3184 prop.SetElements(value)
3185 else:
3186 prop.SetElements([value])
3187 subProxy.UpdateVTKObjects()
3188
3189 # To make WebGL export work
3190 simple.Show()
3191 simple.Render()
3192 self.getApplication().InvokeEvent("UpdateEvent")
3193
3194 try:
3195 if not skipDomain:
3196 self.applyDomains(parentProxy, newProxy.GetGlobalIDAsString())
3197 except Exception as inst:

Callers

nothing calls this directly

Calls 12

validateMethod · 0.95
applyDomainsMethod · 0.95
getMethod · 0.95
sanitizeKeysFunction · 0.85
mapIdToProxyMethod · 0.80
GetGlobalIDAsStringMethod · 0.80
GetDataMethod · 0.45
GetPropertyMethod · 0.45
SetElementsMethod · 0.45
UpdateVTKObjectsMethod · 0.45
ShowMethod · 0.45
RenderMethod · 0.45

Tested by

no test coverage detected