


{"id":397218,"date":"2024-12-12T09:31:09","date_gmt":"2024-12-12T09:31:09","guid":{"rendered":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/spaceclaim-script-from-scratch-for-fully-meshed-model\/"},"modified":"2024-12-12T09:31:09","modified_gmt":"2024-12-12T09:31:09","slug":"spaceclaim-script-from-scratch-for-fully-meshed-model","status":"publish","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/spaceclaim-script-from-scratch-for-fully-meshed-model\/","title":{"rendered":"SpaceClaim Script: from scratch for fully meshed model"},"content":{"rendered":"<p>&lt;p&gt;Dear Ansys Learning Forum Community,&lt;\/p&gt;&lt;p&gt;I am rather new to ANSYS, but delighted about the power of recording and running python script to generate geometry and create a mesh. I am more familiar with ANSA but I will swap my toolset for SPACECLAIM. However, I am still running in a few issues where i could not find a solution yet.&lt;\/p&gt;&lt;p&gt;My aim is to create a model of concentric solid tubes. So far I only achieved to create one tube and mesh it, see below.&lt;\/p&gt;&lt;p&gt;However, I want to create three different parts first (let&#8217;s call it part1 part2 part3) and with some logic create a tube, assign it to one of the parts, create the next concentric tube, assign it to another part and so forth. The parts are repeating (e.g. part1, part2, part3, part1, part2, part3, &#8230;).&lt;\/p&gt;&lt;p&gt;Does anyone have a suggestion how I could achieve that possibly?&lt;\/p&gt;&lt;p&gt;&nbsp;&lt;\/p&gt;<\/p>\n<pre># Python Script, API Version = V232&lt;br&gt;&lt;br&gt;# delete selection&lt;br&gt;#selection = Selection.Create(GetRootPart().GetAllBodies())&lt;br&gt;#result = Delete.Execute(selection)&lt;br&gt;&lt;br&gt;ClearAll()&lt;br&gt;&lt;br&gt;mode = InteractionMode.Solid&lt;br&gt;result = ViewHelper.SetViewMode(mode)&lt;br&gt;GetRootPart().ClearAllPartData()&lt;br&gt;&lt;br&gt;# Define Sketch Plane&lt;br&gt;plane = Plane.PlaneXY&lt;br&gt;result = ViewHelper.SetSketchPlane(plane)&lt;br&gt;&lt;br&gt;# Sketch Inner Circle 1&nbsp;&lt;br&gt;origin = Point2D.Create(MM(0), MM(0))&lt;br&gt;result = SketchCircle.Create(origin, MM(2))&lt;br&gt;&lt;br&gt;# Sketch Inner Circle 1&lt;br&gt;origin = Point2D.Create(MM(0), MM(0))&lt;br&gt;result = SketchCircle.Create(origin, MM(4))&lt;br&gt;&lt;br&gt;# Solidify Sketch&lt;br&gt;mode = InteractionMode.Solid&lt;br&gt;result = ViewHelper.SetViewMode(mode, Info1)&lt;br&gt;&lt;br&gt;# Extrude 1 Face&lt;br&gt;selection = Face1&lt;br&gt;options = ExtrudeFaceOptions()&lt;br&gt;options.ExtrudeType = ExtrudeType.Add&lt;br&gt;result = ExtrudeFaces.Execute(selection, MM(95), options, Info3)&lt;br&gt;&lt;br&gt;# Create\/Edit Mesh&lt;br&gt;options = CreateMeshOptions()&lt;br&gt;options.SolidElementShape = ElementShapeType.Hexahedral&lt;br&gt;options.SurfaceElementShape = ElementShapeType.QuadDominant&lt;br&gt;options.BlockingType = BlockingDecompositionType.Standard&lt;br&gt;options.ElementSize = MM(1)&lt;br&gt;options.MidsideNodes = MidsideNodesType.Kept&lt;br&gt;bodySelection = Body1&lt;br&gt;sweepFaceSelection = Selection.Empty()&lt;br&gt;result = CreateMesh.Execute(bodySelection, sweepFaceSelection, options)&lt;br&gt;&lt;br&gt;&lt;br&gt;# Rename Project&lt;br&gt;GetRootPart().SetName('4695_detailed')&lt;br&gt;&lt;br&gt;# Rename Part&lt;br&gt;GetRootPart().Bodies[0].SetName(\"Ring1\")&lt;br&gt;GetRootPart()&lt;br&gt;&lt;br&gt;&lt;br&gt;<\/pre>\n","protected":false},"template":"","class_list":["post-397218","topic","type-topic","status-publish","hentry"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_bbp_forum_id":["27789"],"_bbp_topic_id":["397218"],"_bbp_author_ip":["194.94.240.88"],"_bbp_last_reply_id":["397378"],"_bbp_last_active_id":["397378"],"_bbp_last_active_time":["2024-12-13 09:36:24"],"_bbp_reply_count":["3"],"_bbp_reply_count_hidden":["0"],"_bbp_voice_count":["2"],"_bbp_engagement":["475219","199"],"_btv_view_count":["1202"],"_bbp_topic_status":["unanswered"],"_bbp_notification_enabled":["475219"],"_bbp_subscription":["199","475219"]},"test":"richard-polzerthi-de"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/397218","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics"}],"about":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/397218\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=397218"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}