Challenge

Week 9 Challenge

OBJECTIVE: REFLECTING MULTIPLE COMPONENTS INDEPENDENT OF THE USER PROFILE.

PROBLEM STATEMENT: To create a macro which performs operations like creating collectors, properties, assigning thickness and reflecting the components according to the user profile.

COMMAND EXPLANATION:

  1. proc lsdyna {n t} {
    set c $n
    set d $t
    *clearmarkall 1
    *createmark comps 1 "$c"
    if {[hm_marklength comps 1 "$c"]!=0} {
    proc box {} {tk_messageBox -message "component already exist" -icon warning -type ok -detail "" -title prompt}
    puts [set prompt [box]]
    } else {
    *createentity comps cardimage=Part name=$c
    *createentity props cardimage=SectShll name=$c
    *setvalue props name=$c STATUS=1 431=$d
    *createmark components 1 "$c"
    *propertyupdate components 1 "$c"
    }
    }
  2. lsdyna is a procedure
  3. n & t are argument variables
  4. *createentity command is used to create the entities like components, properties etc.,
  5. *setvalue command is used to update the existing entity
  6. In property 431 defines the thickness in ls-dyna profile, 95 in Nastran profile, 111 in Abaqus profile, 416 in Pamcrash profile, 431 in Radioss
  7. *propertyupdate command is used to update the properties assigned to the mark of entities.
  8. hm_getstring this command is used to get a string value using a hypermesh panel.
  9. *createmarkpanel this command provides a panel to add entities to a mark.
  10. hm_getmark this command is used to return the entity id’s of the passed type on the specified mark.
  11. hm_info templatetype this command is used to query the information about the templatetype which we are using.
  12. hm_getthickness this command returns the thickness of the specified component, element or property.
  13. hm_entityinfo this command returns varous information of entities like name, id’s etc,.
  14. *copymark elements this command is used to copy elements from one collector to another collector.
  15. *displaycollectorwithfilter comps “off” “$old_n” 1 0 this command is used to change the active state of a collector using the menu filter. Off command is used to turn off all collectors. 1 indicates the elements within components are to be turn on and 0 to turn off. 0 indicates the geometry within components is to be turned off and 1 to turn on.
  16. *autocolorwithmark this command is used to auto color the components with in the usermark.
  17. hm_getcentroid this command is used to get the geometric centroid for selected entities.
  18. *createnode [lindex $o_cog 0] [lindex $o_cog 1] [lindex $o_cog 2] 0 this command is used to create the temp nodes using co-ordinate values. Lindex gives the coordinate values from the list.
  19. hm_getdistance nodes $o_node $t_node 0 this command is used to get the distance between two nodes/points relative to the local coordinate system. 0 is the id of local coordinate system. If 0 is used then it is global coordinate system.
  20. *createmark nodes 1 -1 this command is used to place the nodes on the usermark 1 and -1 retrieve the previous nodes.
  21. hm_nodevalue this command returns the x y z coordinates of the specified node.
  22. *createplane 1 this command is used to create plane. 1, 2 &3 are used to represent the x component of the normal of the plane, y component of the normal of the plane and the z component of the normal of the plane. 0,1,2 are the x y z coordinates of the base point of the plane.
  23. *reflectmarkwithoption elems 1 1 0 this command is used to reflect a selection of entities about a plane. 1 is mark id and 1 is plane id and 0 is to maintain the z-axis of bar elements during reflection
  24. *equivalence comps 1 0.01 1 0 0 this command is used to equivalence the components with in a tolerance. 1 is usermark, 0.01 is the tolerance, 1 is used to equivalence the found nodes, 0-equivalence at the location of the node with the lowest id, 0-retain the number of the node with the lowest id.

CONCLUSION:

Finally a macro is created which performs operations like creating components, properties, assigns thickness and reflects the components according to the user profile.

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.