### Example: PointToDeformableSurfaceContact Setup Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/mv/pointtodeformablesurfacecontact_r.htm This example demonstrates the setup of a model including points, markers, a body, a deformable surface, and the PointToDeformableSurfaceContact entity. It also shows how to configure contact properties and set point locations. ```text *BeginMDL(the_model, "The Model") *Point(p_1, "Point 1") *Point(p_2, "Point 2") *Point(p_3, "Point 3") *Point(p_4, "Point 4") *Point(p_5, "Point 5") *Point(p_6, "Point 6") *DeformableSurface(defsrf_0, "DeformableSurface 0", NATURAL, 3, 2, m_0, m_1, m_2, m_3, m_4, m_5) *Marker(m_0, "Marker 0", b_1, p_1) *Marker(m_1, "Marker 1", b_1, p_2) *Marker(m_2, "Marker 2", b_1, p_3) *Marker(m_3, "Marker 3", b_1, p_4) *Marker(m_4, "Marker 4", b_1, p_5) *Marker(m_5, "Marker 5", b_1, p_6) *Body(b_1, "Body 1") *Body(b_0, "Body 0") *PointToDeformableSurfaceContact(con_0, "Contact 0", b_0, p_1, LINEAR, defsrf_0, false) *SetContact(con_0, 5, 100, 1.0) *Point(p_10, "Point 0" ) *Set(defsrf_0.uspan, 1.1) *SetPoint(p_1, 50, 10, 10) *SetPoint(p_2, 100, 10, 10) *SetPoint(p_3, 150, 10, 10) *SetPoint(p_4, 50, 20, 20) *SetPoint(p_5, 100, 20, 20) *SetPoint(p_6, 150, 20, 20) *SetPoint(p_10, 100, 100, 100) *EndMDL() ``` -------------------------------- ### Example Model Setup with SetForce Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/mv/_setforce_symmetric_single_component_rotation_for_command_sets.htm This example demonstrates the setup of an MDL model including analysis definition, action-reaction force pair creation, and the use of *SetForce within a command set. It also includes template definitions for command sets. ```mdl *BeginMDL(the_model, "Example model") *Analysis(the_analysis, "The analysis", andef) *DefineAnalysis(andef) *ActionReactionForcePair(frc_jnc_bmp, "Jounce Bumper Force", SC_ROT, b_frame, b_uca, p_jnc_frame, p_jnc_uca) *SetForce(force_jnc_bmp, LEFT, ds.real1.value + ds.real2.value) *CommandSet(the_commandset, "Simple command set", evdef, frc_0, tpl_begin, tpl_end) *Template(tpl_begin, "Begin template", USER, tpldef_commandset_begin) *Template(tpl_end, "End template", USER, tpldef_commandset_end) *Template(tpl_superfluous, "Should be ignored", ACF, tpldef_commandset_begin) *EndDefine() *DefineCommandSet(evdef, local_frc_0, local_tpl_begin, local_tpl_end) *Write(local_tpl_begin) *SetForce(force_jnc_bmp, LEFT, ds.real1.value + ds.real3.value) *Write(local_tpl_end) *EndDefine() *DefineTemplate(tpldef_commandset_begin) {AbsToRelative(Solver_File_basename.path, Solver_File_basename.value + ".adm")} PREFERENCES/SIMFAIL=STOPCF *EndDefine() *DefineTemplate(tpldef_commandset_end) STOP *EndDefine() *EndMDL() ``` -------------------------------- ### Get Solver List Example Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/tcl/mdlimodelclient_getsolverlist.htm This example demonstrates how to open a stack, get a session handle, project handle, page handle, window handle, and client handle to then retrieve and display the list of available solver modes. It concludes by releasing all handles and closing the stack. ```tcl hwi OpenStack hwi GetSessionHandle sess1 sess1 GetProjectHandle pro1 pro1 GetPageHandle pa1 [pro1 GetActivePage] pa1 GetWindowHandle win1 [pa1 GetActiveWindow] win1 GetClientHandle mcl tk_messageBox –message “[mcl GetSolverList]”; mcl ReleaseHandle; win1 ReleaseHandle; pa1 ReleaseHandle; pro1 ReleaseHandle; sess1 ReleaseHandle; hwi CloseStack; ``` -------------------------------- ### Get Measure Handle Example Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/tcl/vidivideo_getmeasurehandle.htm This example demonstrates how to open a stack, get session and project handles, retrieve a window and client handle for video, add a movie, add and configure tracking markers, calculate tracking data, get a movie handle, set coordinate system points, add a dynamic measure, and finally retrieve the measure handle. ```tcl hwi OpenStack; hwi GetSessionHandle sess1; sess1 GetProjectHandle proj; proj GetPageHandle page1; page1 GetWindowHandle win1 1; win1 GetClientHandle vid vid AddMovie "c:/video/Marker/data/barrier0411.amf" vid AddTrackingMarker mark1; mark1 SetTrackPoint 84 122; mark1 SetName Hello1 mark1 GetID vid AddTrackingMarker mark2; mark2 SetTrackPoint 282 178; mark2 SetName Hello2 vid CalculateTrackingData; vid GetMovieHandle movie 1 movie SetCSPoint1 Hello1 movie SetCSPoint2 Hello2 vid AddMeasure dynamic vid GetMeasureHandle meas 1 hwi CloseStack; ``` -------------------------------- ### Get XML Output Type Example Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/tcl/hwiwindow_getxmloutputtype.htm This example demonstrates how to get the window handle and then retrieve the XML output type. It assumes prior setup of session, project, and page handles. ```tcl hwi GetSessionHandle mySessionName mySessionName GetProjectHandle myProjectName myProjectName GetPageHandle myPageName [myProjectName GetActivePage] myPageName GetWindowHandle myWindowName [myPageName GetActiveWindow] myWindowName GetXMLOutputType ``` -------------------------------- ### Example: Startup Options Windows Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/getting_started/hm_batch_startup_options_r.htm Demonstrates how to use startup options on Windows. These examples show launching HyperMesh batch with a Tcl script and specific background process settings. ```bash /hm/bin//hmbatch.exe -tcl /home/user/my_script.tcl Linux ``` ```bash /altair/scripts/hmbatch -tcl /home/user/my_script.tcl -nobg ``` -------------------------------- ### Get Distance Rule Starting Point Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/tcl/poiquerydistancerule_getstartat.htm This example demonstrates how to open a stack, get a client handle, add a distance query rule, set its starting point, retrieve the starting point, and then close the stack. It shows the typical workflow for using the GetStartAt command. ```tcl hwi OpenStack hwi GetActiveClientHandle client set ruleID [client AddQueryRule mindist] client GetQueryRuleHandle rule_handle $ruleID rule_handle SetDistance “50” rule_handle SetStartAt Min rule_handle GetStartAt hwi CloseStack ``` -------------------------------- ### Example of *BeginSystem() Usage Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/mv/_beginsystem.htm Illustrates how to use *BeginSystem() within a *BeginSystemGroup() to add a system with attachments. Ensure the system definition and file path are correct. ```script *BeginSystemGroup(sys_boost, "Steering boost", sys_steering) *System("None") *BeginSystem("Steering boost 1", sysdef_boost, "Libs/Models/Steering/Boost/boost1.mdl", "Steering boost 1") *Attach(p_upper_inp, model.sys_steering.p_upper_inp) *Attach(p_tbar, model.sys_steering.p_upper_pin, sys_steering.p_upr_wormshaft) *Attach(b_tbar_att, model.sys_steering.b_pinion, sys_steering.b_wormshaft) *EndSystem() *EndGroup() ``` -------------------------------- ### Example Model Setup with Point Mass Body Pair Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/mv/setpointmassbodyic_point_mass_body_pair_r.htm This example demonstrates setting up points, a point mass body pair, and then defining its initial conditions and flags. It includes model definition and termination. ```Altair HyperWorks *BeginMDL(model, "The model") *PointPair(p_3, "Point 3 pair") *PointPair(p_4, "Point 4 pair") *SetPoint(p_3, LEFT, 31, 32, 33) *SetPoint(p_4, LEFT, 34, 35, 36) *PointmassBodyPair(pmb_2, "Point mass body 2", p_3, p_4) *SetPointmassBody(pmb_2, LEFT, 15) *SetPointmassBodyIC(pmb_2, 81, 82, 83, 84, 85, 86) *SetPointmassBodyICFlag(pmb_2, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE) *EndMDL() ``` -------------------------------- ### Get Sub-Assembly Iterator Handle Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/tcl/poiassembly_getsubassemblyiteratorhandle.htm This example demonstrates how to obtain an iterator handle for sub-assemblies of an assembly with a specific ID. It includes the necessary setup to get the assembly handle first. ```tcl hwi OpenStack hwi GetSessionHandle session_handle session_handle GetProjectHandle project_handle project_handle GetPageHandle page_handle [project_handle GetActivePage] page_handle GetWindowHandle window_handle [page_handle GetActiveWindow] window_handle GetClientHandle client_handle client_handle GetModelHandle model_handle [client_handle GetActiveModel] model_handle GetAssemblyHandle assem_handle 3 assem_handle GetSubAssemblyIteratorHandle subassm_handle hwi CloseStack ``` -------------------------------- ### BeginLibraryManagement() Example Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/preference/beginlibrarymanagement.htm Use this snippet to begin a library management block and register a library. Ensure the path to the library directory is correctly specified. ```preferences *BeginLibraryManagement() *RegisterLibrary(altair_db1, SQL,"C:/home/lm/lmdir1") *EndLibraryManagement() ``` -------------------------------- ### Example Usage of *elempatchdecraction Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/hm/_elempatchdecraction.htm This example demonstrates starting a patch checker, navigating through patches, adjusting patch size, and finally stopping the action. It requires prior setup of quality criteria and element selection. ```tcl *readqualitycriteria c:/criteria/mycriteria.txt *createmark elems 1 displayed *elementqualitysetup 1 *elempatchstartaction 0 1.0 *elempatchnextaction *elempatchnextaction *elempatchincraction *elempatchprevaction *elempatchdecraction *elempatchstopaction *elementqualityshutdown 1 ``` -------------------------------- ### Get list of children on the model Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/tcl/mdliobject_beginchildfastget.htm This example demonstrates how to open a session, get a model handle, and then iterate through all child objects of the model. It uses BeginChildFastGet to start the process and EndChildFastGet to conclude it, printing the variable name of each child. ```tcl hwi OpenStack hwi GetSessionHandle mySessionName mySessionName GetProjectHandle myProjectName set activePageNum [myProjectName GetActivePage] myProjectName GetPageHandle myPageName $activePageNum set activeWinNum [myPageName GetActiveWindow] myPageName GetWindowHandle myWindowName $activeWinNum myClientName GetModelHandle myModelName myModelName BeginChildFastGet False True True "" myModelName GetNumberOfChildren for { set idx 1 } { $idx <= [myModelName GetNumberOfChildren] } {incr idx } myModelName GetChildHandleByIdx child_handle $idx; puts "[child_handle GetVarname]"; child_handle ReleaseHandle; } myModelName EndChildFastGet; myModelName ReleaseHandle myClientName ReleaseHandle myWindowName ReleaseHandle myPageName ReleaseHandle myProjectName ReleaseHandle mySessionName ReleaseHandle hwi CloseStack ``` -------------------------------- ### Example: Setting up Pointmass Bodies and Pairs Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/mv/pointmassbodypair_r.htm This example demonstrates the complete setup for a point mass body pair, including defining individual points, setting their positions, creating the pair, and configuring its initial conditions and flags. ```mdl *BeginMDL( model, "The Model" ) *PointPair( p_3, "Point 3 pair" ) *PointPair( p_4, "Point 4 pair" ) *SetPoint( p_3, LEFT, 31, 32, 33 ) *SetPoint( p_4, LEFT, 34, 35, 36 ) *PointmassBodyPair( pmb_2, "Point mass body 2", p_3, p_4 ) *SetPointmassBody( pmb_2, LEFT, 15 ) *SetPointmassBodyIC( pmb_2, 81, 82, 83, 84, 85, 86 ) *SetPointmassBodyICFlag( pmb_2, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE ) *EndMDL() ``` -------------------------------- ### Get Data Component List for Displacement Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/tcl/poisubcase_getdatacomponentlist.htm This example demonstrates how to retrieve the data component list for 'displacement' with a 'vector' context using the GetDataComponentList command. It includes setup steps for opening a stack, getting handles, and closing the stack. ```tcl hwi OpenStack hwi GetSessionHandle session_handle session_handle GetProjectHandle project_handle project_handle GetPageHandle page_handle [project_handle GetActivePage] page_handle GetWindowHandle window_handle [page_handle GetActiveWindow] window_handle GetClientHandle client_handle client_handle GetModelHandle model_handle [client_handle GetActiveModel] model_handle GetResultCtrlHandle result_handle result_handle GetSubcaseHandle subcase_handle 1 set dcomplist [subcase_handle GetDataComponentList displacement vector]; hwi CloseStack ``` -------------------------------- ### Initialize and Run Adaptive Wrapper Mesh Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/hm/_adaptive_wrapper_reject_clear.htm This example demonstrates the typical workflow for adaptive wrapper meshing, including initialization, building the octree, previewing cavities, generating the mesh, clearing the reject buffer, and ending the wrapper session. ```tcl #Initialization of wrapper mesh with base mesh *createmark elements 1 "all" *adaptive_wrapper_init elements 1 1 0 #Build skeletal octree structure *adaptive_wrapper_build #Preview all cavities *adaptive_wrapper_preview #Generate Mesh *createstringarray 2 "DoRemesh: 1" "RemeshGrowthRate: 1.2" *adaptive_wrapper_mesh 0 1 2 #Clear the reject *adaptive_wrapper_reject_clear #End of wrapper mesh *adaptive_wrapper_end ``` -------------------------------- ### Get Component Translation Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/tcl/poicomponent_gettranslation_2.htm Retrieves the translation vector of a component with a specific ID. This example demonstrates the setup required to obtain a component handle before calling GetTranslation. ```Tcl hwi GetSessionHandle mySessionName mySessionName GetProjectHandle myProjectName set pageIndex [myProjectName GetActivePage] myProjectName GetPageHandle myPageName $pageIndex set windowIndex [myPageName GetActiveWindow] myPageName GetWindowHandle myWindowName $windowIndex myWindowName GetClientHandle myPostName set modelIndex [myPostName GetActiveModel] myPostName GetModelHandle myModelName $modelIndex myModelName GetComponentHandle myComponentName 1 myComponentName GetTranslation ``` -------------------------------- ### Full WAD Lines Analysis Setup and Extraction Example Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/hm/hm_wadlinessetaxes.htm This example demonstrates a complete workflow for setting up WAD lines analysis, including initialization, parameter setting, axis definition, entity selection, wiper setup, reference line extraction, WAD line extraction, and grid point retrieval. ```tcl hm_wadlinesinit hm_wadlinessetparameters 45.0 50.0 100.0 100.0 50.0 20.0 25.0 60.0 hm_wadlinessetaxes 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 0.0 *createmark comps 1 "bonnet" "bumper" "fenderL" "fenderR" *createmark comps 2 "windshield" "a-pillars" hm_wadlinesetentities comps 1 comps 2 *createmark elems 1 "by collector" wipers hm_wadlinesetwipers elems 1 0 1 hm_wadlinesgetreferenceline 0 hm_wadlinesgetreferenceline 1 hm_wadlinesgetreferenceline 2 hm_wadlinesgetreferenceline 3 hm_wadlinesgetreferenceline 4 hm_wadlinesgetreferenceline 5 hm_wadlinesgetreferenceline 6 hm_wadlinesgetreferenceline 7 hm_wadlinesgetwadline 1000.0 hm_wadlinesgetwadline 1500.0 hm_wadlinesgetwadline 1700.0 hm_wadlinesgetwadline 2100.0 hm_wadlinesgetgridpoints 1000.0 1500.0 1700.0 2100.0 50.0 hm_wadlinesend ``` -------------------------------- ### Get System Handle from Joint Handle Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/tcl/mdliobject_getsystemhandle.htm This example demonstrates how to obtain the system handle starting from a joint handle. It involves opening a stack, getting session and project handles, navigating through pages and windows to get the model handle, then the joint handle, and finally the system handle. Remember to release all obtained handles. ```Tcl hwi OpenStack hwi GetSessionHandle mySessionName mySessionName GetProjectHandle myProjectName set activePageNum [myProjectName GetActivePage] myProjectName GetPageHandle myPageName $activePageNum set activeWinNum [myPageName GetActiveWindow] myPageName GetWindowHandle myWindowName $activeWinNum myWindowName GetClientHandle myClientName myClientName GetModelHandle myModelName myModelName GetChildHandle joint_handle j_0; joint_handle GetSystemHandle sys_handle; joint_handle ReleaseHandle; sys_handle ReleaseHandle; myModelName ReleaseHandle; myClientName ReleaseHandle; myWindowName ReleaseHandle; myPageName ReleaseHandle; myProjectName ReleaseHandle; mySessionName ReleaseHandle; hwi CloseStack; ``` -------------------------------- ### Iterating Through Ranges with @rangestart() Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/hm/_rangestart.htm This example demonstrates how to use @rangestart() to get the start of each range. Use *rangeadd() to populate ranges, then iterate using @rangecount(), @rangestart(), and @rangeend(). ```HyperMesh Template elements(104,0,"","") *format() *rangeadd(id) *after() *counterset(counter1,1) *loopif([counter1 <= @rangecount()]) *string("start of range = ") *field(integer,[@rangestart(counter1)],0) *end() *string("end of range = ") *field(integer,[@rangeend(counter1)],0) *end() *counterinc(counter1) *endloop() *rangereset() *output() ``` -------------------------------- ### Example Model Setup with SetFieldStiffness Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/mv/setfieldstiffness_single_field_r.htm This example demonstrates setting up a field model, including defining bodies, points, vectors, and then applying various properties to a field, culminating in setting its stiffness using *SetFieldStiffness. ```md *BeginMDL(model, "Field Model") *Body(b_0, "Body 0") *Body(b_1, "Body 1") *Point(p_0, "Point 0") *Point(p_1, "Point 1") *Point(p_2, "Point 2") *Vector(v_1, "Vector 1") *Vector(v_2, "Vector 2") *Field(fi_0, "Field 0 - Single", b_0, b_1, p_0) *SetOrientation(fi_0, TWOAXES, XY, v_1, v_2) *SetOrientation(fi_0, TWOAXES, XY, p_1, p_2) *SetOrientation(fi_0, ONEAXIS, X, p_1) *SetOrientation(fi_0, ONEAXIS, X, v_1) *SetFieldStiffness(fi_0, 1, 2, 3, ..., 36) *SetFieldDamping(fi_0, CRATIO, .05) *SetFieldLength(fi_0, 5, 6, 7, 8, 9, 10) *SetFieldForce(fi_0, 21, 22, 23, 24, 25, 26) *EndMDL() ``` -------------------------------- ### Add Result Math Expression Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/tcl/poiresultmathctrl_addexpression.htm This example demonstrates how to add a result math expression with the label 'sample'. It includes setup for opening a stack, getting handles, and closing the stack. ```tcl hwi OpenStack hwi GetSessionHandle session_handle session_handle GetProjectHandle project_handle project_handle GetPageHandle page_handle [project_handle GetActivePage] page_handle GetWindowHandle window_handle [page_handle GetActiveWindow] window_handle GetClientHandle client_handle set mid [client_handle AddResultMathAnalysis “c:/samples/bumper/d3plot” “c:/samples/bumper/d3plot”] client_handle GetModelHandle model_handle $mid model_handle GetResultCtrlHandle result_handle result_handle GetResultMathCtrlHandle rmath_handle rmath_handle AddExpression “sample” hwi CloseStack ``` -------------------------------- ### Get 3D Plane Label Location Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/tcl/plt3diplane_getlabellocation.htm Retrieves the label location of a 3D plane. This example demonstrates the typical setup to obtain a plane handle and then query its label location. ```tcl hwi GetSessionHandle mySessionName mySessionName GetProjectHandle myProjectName myProjectName GetPageHandle myPageName [myProjectName GetActivePage] myPageName GetWindowHandle myWindowName [myPageName GetActiveWindow] myWindowName GetClientHandle myPlotName myPlotName GetPlaneHandle myPlaneName [myPlotName AddPlane] myPlaneName GetLabelLocation ``` -------------------------------- ### BeginPart() Syntax Example Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/sessions/beginpart_sf.htm This example demonstrates the basic syntax for the *BeginPart() function, specifying all required parameters to define an added part. ```HyperView *BeginPart(1, "AddedObject.partref1", "PART", 30301, "Rigid Parts", 1, "Part Pool - body", "Global") ``` -------------------------------- ### Create Planar Surface and Mesh Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/hm/_hmmeshsurfaceplane.htm This example demonstrates setting up a planar surface and then meshing it using the *hmmeshsurfaceplane command. It requires prior setup of surface mode, plane creation, and mesh edge parameters. ```tcl *surfacemode 3 *createplane 1 1.0 0.0 0.0 0.0 0.0 0.0 *surfaceplane 1 10.0 *set_meshedgeparams 0 5.0 0 0 0 0 0 0 0 *set_meshedgeparams 1 9.0 0 0 0 0 0 0 0 *set_meshedgeparams 2 5.0 0 0 0 0 0 0 0 *set_meshedgeparams 3 9.0 0 0 0 0 0 0 0 *hmmeshdrag 1 *storemeshtodatabase 0 *ameshclearsurface ``` -------------------------------- ### Create Streamlines for Rakes Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/tcl/poicfd_createstreamlines.htm This example demonstrates how to create streamlines for rakes with IDs '1' and '2' using the poICFD_CreateStreamLines command. It includes the necessary setup to get the CFD control handle. ```tcl hwi OpenStack hwi GetSessionHandle session_handle session_handle GetProjectHandle project_handle project_handle GetPageHandle page_handle [project_handle GetActivePage] page_handle GetWindowHandle window_handle [page_handle GetActiveWindow] window_handle GetClientHandle client_handle client_handle GetModelHandle model_handle [client_handle GetActiveModel] model_handle GetResultCtrlHandle result_handle result_handle GetCFDCtrlHandle CFD_handle CFD_handle AddRake line CFD_handle AddRake area CFD_handle AddRake CreateStreamLines "1 2" hwi CloseStack ``` -------------------------------- ### Setup and Extract Adult Test Zone Coordinates Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/hm/hm_wadlinesgetadulttestzone.htm This example demonstrates the complete setup process, including initialization, parameter and entity setting, grid point generation, and finally extracting the adult test zone coordinates using hm_wadlinesgetadulttestzone. Ensure hm_wadlinesinit has been called and parameters are set before execution. ```tcl hm_wadlinesinit hm_wadlinessetparameters 45.0 50.0 100.0 100.0 50.0 20.0 25.0 60.0 hm_wadlinessetaxes 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 0.0 *createmark comps 1 "bonnet" "bumper" "fenderL" "fenderR" *createmark comps 2 "windshield" "a-pillars" hm_wadlinessetentities comps 1 comps 2 hm_wadlinesgetgridpoints 1000.0 1500.0 1700.0 2100.0 50.0 set zone_vertices [hm_wadlinesgetadulttestzone] hm_wadlinesend ``` -------------------------------- ### Get Maximum Drag Location for a Plane Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/tcl/plt3diplane_getdmax.htm Retrieves the real value of the maximum drag location for the plane along its normal. This example demonstrates the typical setup for querying plane information in HyperWorks Tcl. ```tcl hwi GetSessionHandle mySessionName mySessionName GetProjectHandle myProjectName myProjectName GetPageHandle myPageName [myProjectName GetActivePage] myPageName GetWindowHandle myWindowName [myPageName GetActiveWindow] myWindowName GetClientHandle myPlotName myPlotName GetPlaneHandle myPlaneName [myPlotName AddPlane] myPlaneName GetDMax ``` -------------------------------- ### GetUseTracking Example Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/tcl/vidivideo_getusetracking.htm This example demonstrates how to open a project, add video data, set tracking markers, calculate tracking data, and then retrieve the tracking usage flag. It shows the typical workflow for using the tracking features. ```tcl hwi OpenStack; hwi GetSessionHandle sess1; sess1 GetProjectHandle proj; proj GetPageHandle page1; page1 GetWindowHandle win1 1; win1 GetClientHandle vid vid AddMovie "c:/video/Marker/data/barrier0411.amf" vid AddTrackingMarker mark1; mark1 SetTrackPoint 84 122; mark1 SetName Hello1 vid AddTrackingMarker mark2; mark2 SetTrackPoint 282 178; mark2 SetName Hello2 vid CalculateTrackingData; vid GetMovieHandle movie 1 movie SetCSPoint1 Hello1 movie SetCSPoint2 Hello2 vid SetUseTracking true; vid GetUseTracking; #should return true hwi CloseStack; ``` -------------------------------- ### Set Distance Rule Start Point Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/tcl/poiquerydistancerule_setstartat.htm This example demonstrates how to set the starting point of a distance rule to 'Min' within an advanced query using HyperView Tcl commands. It involves opening a stack, getting a client handle, adding a distance query rule, setting its distance and start point, adding an advanced query, associating the rule with it, and then closing the stack. ```tcl hwi OpenStack hwi GetActiveClientHandle client set ruleID [client AddQueryRule mindist] client GetQueryRuleHandle rule_handle $ruleID rule_handle SetDistance "30" rule_handle SetStartAt Min set advQueryID [client AddAdvancedQuery] client GetAdvancedQueryHandle advancedQuery_handle $advQueryID advancedQuery_handle AddSimulations “current” “current” advancedQuery_handle SetQueryRule "[rule_handle GetID]" advancedQuery_handle SetQuery “entity.id entity.value” advancedQuery_handle GetValueList hwi CloseStack ``` -------------------------------- ### Load XY File Example Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/hwc/xy_load_hwc_r.htm Demonstrates loading an XY file with specified data types, requests, and components. ```bash xy load file= "C:/Program Files/Altair/2020/tutorials/hwdesktop/mv_hv_hg/plotting/ANGACC" ydatatype= "Angular Acceleration" yrequest= all ycomponent= all xdatatype= Time ``` -------------------------------- ### GetZViewableCount Example in HyperView Tcl Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/tcl/poimodel_getzviewablecount.htm This example demonstrates how to open a stack, get session and project handles, add entities to a selection set, retrieve the initial count of viewable entities, change the view orientation, and then retrieve the new count of viewable entities. It requires HyperView Tcl environment setup. ```tcl hwi OpenStack hwi GetSessionHandle session_handle session_handle GetProjectHandle project_handle project_handle GetPageHandle page_handle [project_handle GetActivePage] page_handle GetWindowHandle window_handle [page_handle GetActiveWindow] window_handle GetClientHandle client_handle client_handle GetModelHandle model_handle [client_handle GetActiveModel] model_handle GetSelectionSetHandle set_handle [model_handle AddSelectionSet node]; set_handle Add “id 1-50”; set set_id [set_handle GetID]; set old_count [model_handle GetZViewableCount $set_id]; window_handle GetViewControlHandle view_handle; # Change the view orientation window_handle SetOrientation “21.109207 -37.466278 51.054161 -3.141593 1.047198 -2.356194” # Find out the new count set new_count [model_handle GetZViewableCount $set_id]; hwi CloseStack ``` -------------------------------- ### Get Minimum Drag Location for a Plane Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/tcl/plt3diplane_getdmin.htm Retrieves the real value of the minimum drag location for the plane along its normal. This example demonstrates the typical setup required to obtain a plane handle before calling GetDMin. ```tcl hwi GetSessionHandle mySessionName mySessionName GetProjectHandle myProjectName myProjectName GetPageHandle myPageName [myProjectName GetActivePage] myPageName GetWindowHandle myWindowName [myPageName GetActiveWindow] myWindowName GetClientHandle myPlotName myPlotName GetPlaneHandle myPlaneName [myPlotName AddPlane] myPlaneName GetDMin ``` -------------------------------- ### Complete Adaptive Wrapper Mesh Example Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/hm/_adaptive_wrapper_end.htm This snippet demonstrates the full workflow of initializing, configuring, building, meshing, and terminating the adaptive wrap mesher. Ensure *adaptive_wrapper_init is called before this sequence. ```tcl #Initialization of wrapper mesh with base mesh *createmark elements 1 "all" *adaptive_wrapper_init elements 1 1 0 # Define features *clearmark elements 1 *adaptive_wrapper_set_features 1 1 30 1 1 #Set various meshing and refinement parameters *createstringarray 7 "LeakCheckNodes: 20 24 19" "GapPatchTolerance: 3.0" "HolePatchTolerance: 10.0" "RefineByBoxCompIds: 4 5 6" "RefineByNodeCurvature: 1" "RefineByFeatureProximity: 0" "RefineByAllElemSize: 1" *adaptive_wrapper_set_params 10 0.1 1 7 #Proximity options eval *createstringarray 3 "WithinGroup: 0.5 1 3 10 12 13" "WithinGroup: 1.5 3 9 20" "AcrossGroup: 0.5 3 10 12 13 4 9 8 7 19" *adaptive_wrapper_proximity_params 1 0.2 1 3 #Build skeletal octree structure *adaptive_wrapper_build #Generate mesh *createstringarray 2 "DoRemesh: 1" "RemeshGrowthRate: 1.2" *adaptive_wrapper_mesh 0 1 2 #End of wrapper mesh *adaptive_wrapper_end ``` -------------------------------- ### Get Query Rule List Example Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/tcl/poipost_getqueryrulelist.htm Demonstrates how to open a stack, add query rules, set their parameters, retrieve the list of query rules, and close the stack. ```tcl hwi OpenStack hwi GetActiveClientHandle client set ruleID1 [client AddQueryRule mindist] client GetQueryRuleHandle distance_rule_handle $ruleID1 distance_rule_handle SetDistance "20" set ruleID2 [client AddQueryRule extreme] client GetQueryRuleHandle extreme_rule_handle $ruleID2 extreme_rule_handle SetExtreme "TopN 2" client GetQueryRuleList hwi CloseStack ``` -------------------------------- ### Create a new body using InterpretEntity Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/tcl/mdliobject_interpretentity.htm This example demonstrates how to create a new body entity with a specific label using the InterpretEntity command. It includes setup for opening a session, getting handles, and releasing them afterwards. ```tcl hwi OpenStack hwi GetSessionHandle mySessionName mySessionName GetProjectHandle myProjectName set activePageNum [myProjectName GetActivePage] myProjectName GetPageHandle myPageName $activePageNum set activeWinNum [myPageName GetActiveWindow] myPageName GetWindowHandle myWindowName $activeWinNum myWindowName GetClientHandle myClientName myClientName GetModelHandle myModelName myModelName InterpretEntity new_handle Body b_0 "\"My Body\" " new_handle ReleaseHandle myModelName ReleaseHandle myClientName ReleaseHandle myWindowName ReleaseHandle myPageName ReleaseHandle myProjectName ReleaseHandle mySessionName ReleaseHandle hwi CloseStack ``` -------------------------------- ### Create an mdlCheckBox Widget Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/tcl/_model_procedures_mdlcheckbox.htm This example demonstrates how to create an mdlCheckBox widget tied to a 'floating' data member of a 'Marker' entity. It includes setup for getting client and model handles, interpreting the entity, and releasing handles. ```tcl ::model::GetClientHandle clnt clnt GetModelHandle mdl clnt ReleaseHandle mdl InterpretEntity mrk Marker m_0 "" "" "" mdl ReleaseHandle set dlg [toplevel .dlg] set frm [frame $dlg.frm -padx 10 -pady 10] grid $frm -row 0 -column 0 -sticky nesw set chk_box [::model::mdlCheckBox .dlg.frm.chk_box mrk "floating" -label "Floating" \ -enable true ] grid $chk_box -row 0 -column 0 mrk ReleaseHandle ``` -------------------------------- ### System Definition and Initial Condition Setting Example Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/mv/setpointmassbodyic_all_point_mass_bodies_in_a_system_r.htm This example demonstrates defining a system, setting initial conditions for its bodies, and then defining another system that references bodies from the first. It shows how to use both *SetPointmassBodyIC and *SetBodyIC with specific values or references. ```Altair HyperWorks *System(sys_frnt, "Front suspension", sysdef_frnt, b_body) *SetPointmassBodyIC(sys_frnt, 1000, 0, 0) *SetPointmassBodyIC(sys_frnt.b_wheel, , , 100) *System(sys_driveline, "Driveline", sysdef_driveline, sys_frnt.b_wheel) *SetSystem(sys_driveline) *SetBodyIC(BODIES, model_sys_frnt.b_wheel.vx, , model.sys_frnt.b_wheel.wz) ``` -------------------------------- ### Get Waterfall Handle Example Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/tcl/plt3diplot_getwaterfallhandle.htm This example demonstrates how to obtain a handle to a waterfall curve. It involves getting session, project, page, window, and client handles before finally getting the waterfall handle. ```tcl hwi GetSessionHandle mySessionName mySessionName GetProjectHandle myProjectName myProjectName GetPageHandle myPageName [myProjectName GetActivePage] myPageName GetWindowHandle myWindowName [myPageName GetActiveWindow] myWindowName GetClientHandle myPlotName myPlotName GetWaterfallHandle myGroupName [myPlotName AddWaterfall] ``` -------------------------------- ### Set and Get Simulation Steps for Tracing Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/tcl/poitracingctrl_getsimsteplist.htm This example demonstrates how to set up tracing for specific nodes, set the tracing mode to list, define the simulation steps to trace, and then retrieve the mode and the list of simulation steps. It also includes error handling and prints the results to the console. ```tcl hwi OpenStack if {[catch { hwi GetSessionHandle session_handle hwi GetActiveClientHandle client_handle client_handle GetModelHandle model_handle [client_handle GetActiveModel] model_handle GetTracingCtrlHandle tc_handle tc_handle AddEntity node "Node 251" tc_handle AddEntity node "Node 197" tc_handle SetEntityColor node "Node 197" "255 0 0"; tc_handle SetMode list; tc_handle SetSimSteps "0 1 2 3 4 5"; set mode [tc_handle GetMode]; set sList [tc_handle GetSimStepList]; set traceColor [tc_handle GetEntityColor node "Node 251"]; set traceColor2 [tc_handle GetEntityColor node "Node 197"]; } result]} { global errorInfo; puts stderr $result; puts "[session_handle GetError]"; puts stderr "*** Tcl TRACE ***"; puts stderr $errorInfo; } else { puts "********"; puts "Mode = $mode"; puts "Steps = $sList"; puts "********"; puts "No errors."; puts "Warnings: "; puts " [session_handle GetError]"; } hwi CloseStack ``` -------------------------------- ### Get Task Wizard File for User Profile Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/tcl/mdlimodelclient_gettaskwizardfile.htm This example demonstrates how to retrieve and print the task wizard file path for the user profile using the `mdlIModelClient_GetTaskWizardFile` command. It includes necessary setup and cleanup steps for the session and handles. ```tcl hwi OpenStack hwi GetSessionHandle sess1 sess1 GetProjectHandle pro1 pro1 GetPageHandle pa1 [pro1 GetActivePage] pa1 GetWindowHandle win1 [pa1 GetActiveWindow] win1 GetClientHandle mcl set temp [mcl GetTaskWizardFile User] puts "The Task Wizard File For User Profile Is $temp" mcl ReleaseHandle; win1 ReleaseHandle; pa1 ReleaseHandle; pro1 ReleaseHandle; sess1 ReleaseHandle; hwi CloseStack; ``` -------------------------------- ### BeginMdlDefaults() Example Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/preference/beginmdldefaults.htm Demonstrates the usage of BeginMdlDefaults() to define a preferences block, including nested defaults for GUI and MDL settings. Ensure a matching EndMdlDefaults() is used. ```text *BeginModelDefaults() *BeginModelGUIDefaults() *BeginUserMode(model, "Beginner") *Hide(Templates, Bushings) *EndUserMode() *EndModelGUIDefaults() *BeginMdlDefaults() *RegisterAdamsScript(label1, "/usr/people/altair/ex_exe") *EndMdlDefaults() *EndModelDefaults() ``` -------------------------------- ### Get Operator Syntax in HyperView Tcl Query Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/tcl/poiresultmathctrl_getoperatorsyntax.htm This example demonstrates how to obtain the syntax for a specific result math operator, 'log', from the 'math' library. It includes the necessary setup to open a session, get handles for project, page, window, and client, add a result math analysis, and then retrieve the result math control and operator syntax. ```tcl hwi OpenStack hwi GetSessionHandle session_handle session_handle GetProjectHandle project_handle project_handle GetPageHandle page_handle [project_handle GetActivePage] page_handle GetWindowHandle window_handle [page_handle GetActiveWindow] window_handle GetClientHandle client_handle set mid [client_handle AddResultMathAnalysis “c:/samples/bumper/d3plot” “c:/samples/bumper/d3plot”] client_handle GetModelHandle model_handle $mid model_handle GetResultCtrlHandle result_handle result_handle GetResultMathCtrlHandle rmath_handle rmath_handle GetOperatorSyntax math log hwi CloseStack ``` -------------------------------- ### Get Path List Example Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/tcl/mdlimodelcient_getpathlist.htm Demonstrates how to open a stack, get session and project handles, navigate to a specific page and window, retrieve the model client handle, and then use GetPathList to display the paths. It also shows the necessary handle release and stack closing steps. ```tcl hwi OpenStack hwi GetSessionHandle sess1 sess1 GetProjectHandle pro1 pro1 GetPageHandle pa1 [pro1 GetActivePage] pa1 GetWindowHandle win1 [pa1 GetActiveWindow] win1 GetClientHandle mcl tk_messageBox –message “[mcl GetPathList]“; mcl ReleaseHandle; win1 ReleaseHandle; pa1 ReleaseHandle; pro1 ReleaseHandle; sess1 ReleaseHandle; hwi CloseStack; ``` -------------------------------- ### Delete Streamlines for Specific Rakes Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/tcl/poicfd_deletestreamlines.htm This example demonstrates how to delete streamlines for rakes with specific IDs. It includes setup for opening a session, getting handles, creating rakes, creating streamlines, and finally deleting streamlines for rake ID '2'. ```tcl hwi OpenStack hwi GetSessionHandle session_handle session_handle GetProjectHandle project_handle project_handle GetPageHandle page_handle [project_handle GetActivePage] page_handle GetWindowHandle window_handle [page_handle GetActiveWindow] window_handle GetClientHandle client_handle client_handle GetModelHandle model_handle [client_handle GetActiveModel] model_handle GetResultCtrlHandle result_handle result_handle GetCFDCtrlHandle CFD_handle CFD_handle AddRake line CFD_handle AddRake area CFD_handle AddRake CreateStreamLines "1 2" CFD_handle AddRake DeleteStreamLines "2" hwi CloseStack ``` -------------------------------- ### Example: Setting up Joints and Coupler Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/mv/setcoupler_single_coupler_r.htm This example demonstrates the setup of various joints (revolute, translational) and bodies, followed by the definition of a 3-joint coupler and setting its ratios. This code is typically part of a larger model definition within *BeginMdl(). ```text *RevJoint(rj_kingpinleft, "Left Kingpin Joint", b_leftknuckle, b_ground, p_lknuckle_cg, v_Z) *RevJoint(rj_kingpinright, "Right Kingpin Joint", b_rightknuckle, b_ground, p_rknuckle_cg, v_Z) *TransJoint(tj_rack, "Rack Joint", b_rack, b_ground, p_rack, v_Y) *Body(b_leftknuckle, "Left Knuckle", p_lknuckle_cg) *Body(b_rightknuckle, "Right Knuckle", p_rknuckle_cg) *Body(b_rack, "Right Knuckle", p_rack_cg) *Point(p_lknuckle_cg, "Left Knuckle Pt") *Point(p_rknuckle_cg, "Right Knuckle Pt") *Point(p_rack_cg, "Right Knuckle Pt") *Vector(v_Z, "Global Z") *Vector(v_Y, "Global Y") *Coupler(rot_cplr, "Rot Coupler", rj_kingpinleft, rj_kingpinright, rj_rack, ROT, ROT, TRANS) *SetCouplerType(rot_cplr, 3JOINT) *SetCoupler(rot_cplr, 5.0, 10.0) ``` -------------------------------- ### Get Plane Handle Example Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/tcl/plt3diplot_getplanehandle.htm This example demonstrates how to obtain a handle to a plane within a HyperWorks Tcl session. It involves getting session, project, page, window, and client handles before finally getting the plane handle. ```tcl hwi GetSessionHandle mySessionName mySessionName GetProjectHandle myProjectName myProjectName GetPageHandle myPageName [myProjectName GetActivePage] myPageName GetWindowHandle myWindowName [myPageName GetActiveWindow] myWindowName GetClientHandle myPlotName myPlotName GetPlaneHandle myGroupName [myPlotName AddPlane] ``` -------------------------------- ### Get Input Principal Point Offset of a View Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/tcl/poi3dviewctrl_getinputprincipalpointoffset.htm Retrieves the input principal point offset for a view named "View 1". This example demonstrates the typical HyperView Tcl Query setup required to access view-specific properties. ```tcl hwi OpenStack hwi GetSessionHandle session_handle session_handle GetProjectHandle project_handle project_handle GetPageHandle page_handle [project_handle GetActivePage] page_handle GetWindowHandle window_handle [page_handle GetActiveWindow] window_handle GetViewControlHandle view_handle view_handle GetInputPrincipalPointOffset "View 1" hwi CloseStack ``` -------------------------------- ### Get Raw Values from a Vector Tcl Example Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/tcl/pltivector_getrawvalueslist.htm This example demonstrates how to get the raw data values of a vector. Ensure a curve is present on the plot client before execution. ```tcl #Precondition : A curve must be available on the plot client window. hwi GetActiveClientHandle cl;#Must be a plot client. cl GetCurveHandle crv 1;#Get the handle of the curve at index 1. crv GetVectorHandle yvec y;#Possible options are x or y or u or v. yvec GetRawValuesList ``` -------------------------------- ### Example hm.cfg Commands Source: https://2021.help.altair.com/2021/hwdesktop/hwd/topics/reference/customization/hm_cfg.htm This snippet shows an example of commands that can be used in the hm.cfg file to control HyperMesh startup preferences. Commands can be commented out by removing the leading asterisk. ```cfg *menufont(2) *titlefont(3) *graphicfont(1) ```