Run SpaceClaim commands from Workbench ACT console
Hi
I faced an issue with how to send commands from Workbench to SpaceClaim.
I tried to use the next code as an example, but the command is not executing in SC:
staticSys = GetTemplate(TemplateName = "Static Structural", Solver = "ANSYS").CreateSystem()
staticSys.DisplayText = "Blade Model"
geomCont = staticSys.GetContainer(ComponentName = "Geometry")
geomCont.Edit(IsSpaceClaimGeometry = True, Interactive = True)
cmd = """
import clr
clr.AddReference("SpaceClaim.Api.V20")
from SpaceClaim.Api.V20 import *
sectionPlane = Plane.PlaneZX
result = ViewHelper.SetSketchPlane(sectionPlane, Info4)
point = Point2D.Create(MM(0), MM(0))
result = SketchPoint.Create(point)
baseSel = SelectionPoint.Create(CurvePoint2)
targetSel = SelectionPoint.Create(DatumPoint2)
result = Constraint.CreateCoincident(baseSel, targetSel)
mode = InteractionMode.Solid
result = ViewHelper.SetViewMode(mode, Info5)
"""
geomCont.SendCommand(Language = "Python", Command = cmd)
Answers
-
Try testing your script in SpaceClaim first to check it's robustness.
Line: result = ViewHelper.SetSketchPlane(sectionPlane, Info4) fails because info4 is not defined. That is something created during the GUI but can usually be ignored when scripting.
CurvePoint2 is also not defined....Once the script works in SC and you are sure everything is defined, then try to send it from WB.
0 -
Hi M!
I find the issue So I want to share with solution.
When you want to send commands from WB to Space Claim or Mechanical you should send not the whole code as I did, but split it by lines and send each line in the cycle.BR Ihor
0