Additonal graphics only in Python Result?
RvdH
Member Posts: 12
**
in Structures
I would like to plot a path on top of the actual results for the entire model to verify the exact location of the path. The script below works fine but the path remains visible when changing to other results. The intention is to see the path only on the contents of the Python Result object. In ACT one could respond to a closing of a result and remove the graphics but is something similar also possible with a Python Result object?
def post_started(sender, analysis):# Do not edit this line define_dpf_workflow(analysis) def define_dpf_workflow(analysis): import mech_dpf import Ans.DataProcessing as dpf mech_dpf.setExtAPI(ExtAPI) dataSource = dpf.DataSources(analysis.ResultFileName) #Von Mises stress u = dpf.operators.result.stress_von_mises() u.inputs.data_sources.Connect(dataSource) PathList=DataModel.GetObjectsByType(DataModelObjectCategory.Path) for Path in PathList: if Path.PathType==PathScopingType.Edge: if Path.InternalObject.EdgeGeometryDefineBy==0: EdgeId=Path.Location Edge=DataModel.GeoData.GeoEntityById(EdgeId.Ids[0]) Point3D = Graphics.CreateWorldPoint with Graphics.Suspend(): points=[] for counter in range(0,int(Edge.Points.GetLength(0)/3)): points.Add(Point3D(Edge.Points[counter*3],Edge.Points[counter*3+1],Edge.Points[counter*3+2])) coll = Graphics.Scene.CreateChildCollection() l1 = coll.Factory3D.CreatePolyline(points) l1.Color=0xFF0000 l1.LineWeight=5 l1.Visible=True l1.Closed = True ExtAPI.Graphics.Scene.Visible = True dpf_workflow = dpf.Workflow() dpf_workflow.Add(u) dpf_workflow.SetOutputContour(u) dpf_workflow.Record('wf_id', False) this.WorkflowId = dpf_workflow.GetRecordedId()
0
Answers
-
A quick way to remove the line representing the path would be to open mechanical scripting and issuing the following command in the shell: Graphics.Scene.Clear()
I would prefer an option in the Python result object.0 -
@Pierre Thieffry Any ideas?
0