TAGGED: AIM-FAQ
-
-
December 27, 2021 at 7:19 am
evan_gu
SubscriberError with Spacescripting when record mesh generate and rerun the code.
it is fine using debug mode and error using run mode.
code:
# Create/Edit Mesh
options = CreateMeshOptions()
options.SolidElementShape = ElementShapeType.Hexahedral
options.SurfaceElementShape = ElementShapeType.QuadDominant
options.BlockingType = BlockingDecompositionType.BoundingBox
bodySelection = BodySelection.Create(GetRootPart().Bodies[0])
sweepFaceSelection = Selection.Empty()
result = CreateMesh.Execute(bodySelection, sweepFaceSelection, options)
# EndBlockError messeage:
System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component.
at System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method, Object[] args, Boolean synchronous)
at System.Windows.Forms.Control.Invoke(Delegate method, Object[] args)
at SpaceClaim.UserInterface.ScriptHelper.ExecuteAllOnMainThread[T](GetValue`1 task)
at SpaceClaim.Api.V21.Scripting.Commands.CreateMesh.Execute(ISelection bodies, ISelection sourceFaces, CreateMeshOptions options, ICommandInfo info)
at Microsoft.Scripting.Interpreter.FuncCallInstruction`5.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.LightLambda.Run6[T0,T1,T2,T3,T4,T5,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)
at System.Dynamic.UpdateDelegates.UpdateAndExecute5[T0,T1,T2,T3,T4,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4)
at Microsoft.Scripting.Interpreter.DynamicInstruction`6.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame) -
December 27, 2021 at 7:24 am
evan_gu
SubscriberDose anyone have the same problem?
-
December 27, 2021 at 7:25 am
evan_gu
SubscriberALL CODE:
# Python Script, API Version = V19
ClearAll()
# Set New Sketch
result = SketchHelper.StartConstraintSketching()
# EndBlock# Sketch Rectangle
plane = Plane.PlaneZX
result = ViewHelper.SetSketchPlane(plane)
point1 = Point2D.Create(MM(4),MM(-3))
point2 = Point2D.Create(MM(-8),MM(-3))
point3 = Point2D.Create(MM(-8),MM(4))
result = SketchRectangle.Create(point1, point2, point3)
# EndBlock# Solidify Sketch
mode = InteractionMode.Solid
result = ViewHelper.SetViewMode(mode, None)
# EndBlock# Extrude 1 Face
selection = FaceSelection.Create(GetRootPart().Bodies[0].Faces[0])
options = ExtrudeFaceOptions()
options.ExtrudeType = ExtrudeType.Add
result = ExtrudeFaces.Execute(selection, MM(6.26), options)
# EndBlock# Set Sketch Plane
sectionPlane = Plane.PlaneXY
result = ViewHelper.SetSketchPlane(sectionPlane, None)
# EndBlock# Move section plane
axis = HandleAxis.Z
distance = MM(9.06)
result = ViewHelper.TransformSectionPlaneAlongAxis(axis, distance)
# EndBlock# Set New Sketch
result = SketchHelper.StartConstraintSketching()
# EndBlock# Sketch Rectangle
point1 = Point2D.Create(MM(1),MM(3))
point2 = Point2D.Create(MM(7),MM(3))
point3 = Point2D.Create(MM(7),MM(-2))
result = SketchRectangle.Create(point1, point2, point3)
# EndBlock# Solidify Sketch
mode = InteractionMode.Solid
result = ViewHelper.SetViewMode(mode, None)
# EndBlock# Extrude 1 Face
selection = FaceSelection.Create(GetRootPart().Bodies[1].Faces[0])
options = ExtrudeFaceOptions()
options.ExtrudeType = ExtrudeType.ForceCut
result = ExtrudeFaces.Execute(selection, MM(-1*Parameters.H), options)
## Create/Edit Mesh
options = CreateMeshOptions()
options.SolidElementShape = ElementShapeType.Hexahedral
options.SurfaceElementShape = ElementShapeType.QuadDominant
options.BlockingType = BlockingDecompositionType.BoundingBox
bodySelection = BodySelection.Create(GetRootPart().Bodies[0])
sweepFaceSelection = Selection.Empty()
result = CreateMesh.Execute(bodySelection, sweepFaceSelection, options)
# EndBlock -
December 27, 2021 at 7:30 am
Charudatta Bandgar
SubscriberHello LD Gu
Let me check.
-
December 27, 2021 at 7:54 am
Charudatta Bandgar
SubscriberHello LD Gu
Are you using SpaceClaim meshing?
Regards.
-
December 27, 2021 at 8:05 am
-
-
December 27, 2021 at 8:02 am
evan_gu
Subscriberyes
-
December 27, 2021 at 8:12 am
Charudatta Bandgar
SubscriberHello LD Gu
SpaceClaim meshing module is not included in the Discovery package. I think it is part of the SpaceClaim that comes with workbench, and not Discovery SpaceClaim.
Regarding your question on Ansys SpaceClaim meshing or workbench, please post it on ANSYS Customer Portal or Ansys Learning Forum based on the type of license that you have, so that experts in the domain would be able to help you better. This ANSYS Discovery Community Forum is intended for seeking help on ANSYS Discovery products, and experts on the respective product will be able to help you better there.
Thank you for your understanding!
-
-
December 27, 2021 at 8:19 am
evan_gu
Subscriberthinks!
-
- The topic ‘Error with Spaceclaim scripting’ is closed to new replies.
-
3492
-
1057
-
1051
-
965
-
942
© 2025 Copyright ANSYS, Inc. All rights reserved.