{"id":4921,"date":"2020-12-17T10:50:54","date_gmt":"2020-12-16T23:50:54","guid":{"rendered":"https:\/\/www.computationalfluiddynamics.com.au\/?p=3507"},"modified":"2020-12-17T10:50:54","modified_gmt":"2020-12-16T23:50:54","slug":"using-scripted-record-blocks-to-allow-geometry-parameterisation-in-spaceclaim-2","status":"publish","type":"post","link":"https:\/\/www.leapaust.com.au\/blog\/cfd\/using-scripted-record-blocks-to-allow-geometry-parameterisation-in-spaceclaim-2\/","title":{"rendered":"Using scripted \u201cRecord Blocks\u201d to allow geometry parameterisation in SpaceClaim"},"content":{"rendered":"<div id=\"bsf_rt_marker\"><\/div><p>[vc_row][vc_column][vc_column_text]In the latest release of Ansys SpaceClaim, CAE users can now leverage new scripting capabilities to help efficiently automate the generation of new geometry designs. At LEAP Australia we have been helping customers across Australia &amp; New Zealand to use scripting in SpaceClaim to create design templates that can automatically generate different designs, simply by modifying a few key parameters. Building on the information we shared in <a href=\"https:\/\/www.computationalfluiddynamics.com.au\/supercharge-your-geometry-model-preparation-with-ansys-spaceclaim-scripting\/\" target=\"_blank\" rel=\"noopener noreferrer\"><span style=\"text-decoration: underline;\">our recent webinar<\/span><\/a> and the availability of new features in the latest release 2020R2, these new scripting and feature tracking capabilities in SpaceClaim are now ready for mainstream use.<\/p>\n<p>Ansys\u2019s strength in allowing users to parameterise key design variables is well known. This significantly reduces the need for manual intervention when exposing the client\u2019s designs to various design conditions. Typically during the design phase, multiple geometric parameters are varied whilean initial prototype is developed. Historically, Ansys DesignModeler has helped users to createparametric models but DesignModeler could become unwieldy when working on complex models with multiple dependencies. In contrast, Ansys SpaceClaim has a distinct advantage in working with complex models, but the nature of a Direct Modeller meant that it was not intended to be used to build a model from the ground-up using parameters.<\/p>\n<p>Ansys have addressed this to bring the best of both worlds to SpaceClaim in version 2020 R2 by releasing two powerful new features. The first is the ability to record blocks and the second is to introduce the ability to create scripts using Python API within the SpaceClaim environment. In this blog, we will aim to give you an overview of the first feature called \u201cBlock recording\u201d and showcase how this can be leveraged to automate our customer\u2019s workflows.<\/p>\n<p><strong>Recording Blocks in SpaceClaim<\/strong><\/p>\n<p>The \u201cRecord Block\u201d feature in SpaceClaim helps you to modularize your design into various blocks. For example, you can import models with existing parameters. You can also create 2D sketches of lines, arcs, and splines and convert them into 3D models. Block Recording captures all the changes you make to your model in blocks of script. As you perform operations, they are recorded in script blocks. Each block represents a block-of-script that can be used to recreate that part of the model design when the script is run once again.<\/p>\n<p>Using the record blocks feature can help you to develop your designs in a logical and organic manner, helping them improve the efficiency of their CAD modelling workflow. Each \u201cRecord Block\u201d feature allows the user to create dimensions within the block operations. Users can create sketches in a block, dimension them, and set these dimensions to be a parameter than can be varied at a later stage. The next section demonstrates how to use the block recording feature to create a parameterized geometry in SpaceClaim.<\/p>\n<p><strong>Geometry creation through Record Blocks feature<\/strong><\/p>\n<p>In this section, we will look at how to use the block recording feature to create the fluid domain around a piano-key shaped weir. The key steps for creating this geometry through the record blocks feature are illustrated below with the help of a few screen captures.<\/p>\n<p>Open SpaceClaim 2020 R2 and switch on block recording by clicking on the \u201cBlocks\u201d icon. You will see a new panel appear which starts recording these blocks. Once this is switched on, you can switch to the sketching mode to start creating and dimensioning your sketches. Once a dimension is created in a sketch, it can be converted to a parameter.[\/vc_column_text][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<video controls=\"controls\" width=\"100%\" height=\"100%\"><source src=\"https:\/\/public-leapaust.s3-ap-southeast-2.amazonaws.com\/video\/Create+Sketch+SpaceClaim.mp4\" type=\"video\/mp4\" \/>Your browser does not support the video tag.<\/video>[\/vc_column_text][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]The sketches thus created can form the building blocks of more complex geometries. Here, a move pattern is created using the sketch created in the previous step.[\/vc_column_text][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<video controls=\"controls\" width=\"100%\" height=\"100%\"><source src=\"https:\/\/public-leapaust.s3-ap-southeast-2.amazonaws.com\/video\/Record+Block+Move+Feature.mp4\" type=\"video\/mp4\" \/>Your browser does not support the video tag.<\/video>[\/vc_column_text][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]You can record a custom script written using Python API within the SpaceClaim environment to give you more flexibility in creating your geometries. Result of an operation within a block can create faces, bodies or other geometric entities. These can be selected for subsequent operations as shown in the video below. Upon completion of a block operation, it is often a good idea to change a parameter and rerun the script to ensure it runs without errors.[\/vc_column_text][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<video controls=\"controls\" width=\"100%\" height=\"100%\"><source src=\"https:\/\/public-leapaust.s3-ap-southeast-2.amazonaws.com\/video\/Insert+Custom+Block+SpaceClaim.mp4\" type=\"video\/mp4\" \/>Your browser does not support the video tag.<\/video>[\/vc_column_text][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]The next step is to extrude these blocks to form a solid. In order to achieve this, we need to use the pull tool to pull the faces of existing surfaces by the desired distance to create the desired solids. The faces created in the previous pattern operation and from the creation of the custom block can be selected for the extrusion as shown in the video below.[\/vc_column_text][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<video controls=\"controls\" width=\"100%\" height=\"100%\"><source src=\"https:\/\/public-leapaust.s3-ap-southeast-2.amazonaws.com\/video\/Extrude+Pattern+Block.mp4\" type=\"video\/mp4\" \/>Your browser does not support the video tag.<\/video>[\/vc_column_text][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]Next step is to create a fluid enclosure around the blocks and specify the necessary boundary conditions as shown in the recording below.[\/vc_column_text][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<video controls=\"controls\" width=\"100%\" height=\"100%\"><source src=\"https:\/\/public-leapaust.s3-ap-southeast-2.amazonaws.com\/video\/Create+Fluid+Enclosure.mp4\" type=\"video\/mp4\" \/>Your browser does not support the video tag.<\/video>[\/vc_column_text][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]The last step is to use the combine operation to create the desired geometry. This geometry can now be parameterized for the number of keys of the piano weir, and the height, length and thickness of the keys of the weir can also be parametrically varied through this script.[\/vc_column_text][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<video controls=\"controls\" width=\"100%\" height=\"100%\"><source src=\"https:\/\/public-leapaust.s3-ap-southeast-2.amazonaws.com\/video\/Combine+Final+Geometry.mp4\" type=\"video\/mp4\" \/>Your browser does not support the video tag.<\/video>[\/vc_column_text][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]The model is now ready to be meshed in Fluent meshing for running a Volume of Fluid simulation in Fluent. Parameterising the model at the geometry stage can allow us to simulate how the height of the water upstream of the weir changes with the number of keys in the piano weir -but that is a story for another blog post![\/vc_column_text][\/vc_column][\/vc_row]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How can CAE users make the most of the new scripting capabilities available in SpaceClaim 2020R2 to help efficiently automate the generation of new geometry designs? We look at how to create design templates that can automatically generate different designs, simply by modifying a few key parameters.<\/p>\n","protected":false},"author":3,"featured_media":4596,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","neve_meta_reading_time":"","footnotes":""},"categories":[323],"tags":[171,181,407,201,215,292],"class_list":["post-4921","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cfd","tag-ansys","tag-ansys-meshing","tag-design-and-testing","tag-design-optimisation","tag-expert-training","tag-spaceclaim"],"_links":{"self":[{"href":"https:\/\/www.leapaust.com.au\/blog\/wp-json\/wp\/v2\/posts\/4921","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.leapaust.com.au\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.leapaust.com.au\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.leapaust.com.au\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.leapaust.com.au\/blog\/wp-json\/wp\/v2\/comments?post=4921"}],"version-history":[{"count":0,"href":"https:\/\/www.leapaust.com.au\/blog\/wp-json\/wp\/v2\/posts\/4921\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.leapaust.com.au\/blog\/wp-json\/wp\/v2\/media\/4596"}],"wp:attachment":[{"href":"https:\/\/www.leapaust.com.au\/blog\/wp-json\/wp\/v2\/media?parent=4921"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.leapaust.com.au\/blog\/wp-json\/wp\/v2\/categories?post=4921"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.leapaust.com.au\/blog\/wp-json\/wp\/v2\/tags?post=4921"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}