Jump to content

vipin

Members
  • Content Count

    108
  • Joined

  • Last visited

  • Days Won

    8

Reputation Activity

  1. vipin liked a post in a topic by tinh in Duplication of elements with different orientation   
    Code is like this
    proc p_GetMaxSurf {SurfList {n 1}} { set SaList {} foreach SurfId $SurfList { lappend SaList "$SurfId [hm_getareaofsurface surfs $SurfId]" } lrange [dict keys [join [lsort -decreasing -real -index 1 $SaList]]] 0 $n-1 } proc p_GetMaxLine {LineList {n 1}} { set ElList {} foreach EdgeId $LineList { lappend ElList "$EdgeId [hm_linelength $EdgeId]" } lrange [dict keys [join [lsort -decreasing -real -index 1 $ElList]]] 0 $n-1 } proc p_Mcopy args { *createmarkpanel comps 1 "Select source comp:" if {[hm_marklength comps 1]!=1} {return -code error "Select 1 comp only"} set SourceComp [hm_getmark comps 1] *createmark elems 1 "by comp id" $SourceComp if {![hm_marklength elems 1]} {return -code error "Comp #$SourceComp has no element"} set SourceElems [hm_getmark elems 1] *createmark surfs 1 "by comp id" $SourceComp if {![hm_marklength comps 1]} {return -code error "Comp #$SourceComp has no surface"} set SourceSurfs [hm_getmark surfs 1] set MaxSurf [p_GetMaxSurf $SourceSurfs] lassign [p_GetMaxLine [join [hm_getsurfaceedges $MaxSurf]] 3] Line1 Line2 Line3 *createmark lines 1 $Line1 *nodecreateonlines lines 1 1 0 0 set N1 [hm_latestentityid nodes] *createmark lines 1 $Line2 *nodecreateonlines lines 1 1 0 0 set N2 [hm_latestentityid nodes] *createmark lines 1 $Line3 *nodecreateonlines lines 1 1 0 0 set N3 [hm_latestentityid nodes] ############################################### *createmarkpanel comps 1 "Select target comps:" hm_markremove comps 1 $SourceComp foreach TargetComp [hm_getmark comps 1] { *createmark surfs 1 "by comp id" $TargetComp if {[hm_marklength surfs 1]} { set MaxSurf [p_GetMaxSurf [hm_getmark surfs 1]] lassign [p_GetMaxLine [join [hm_getsurfaceedges $MaxSurf]] 3] Line1 Line2 Line3 *createmark lines 1 $Line1 *nodecreateonlines lines 1 1 0 0 set N1_ [hm_latestentityid nodes] *createmark lines 1 $Line2 *nodecreateonlines lines 1 1 0 0 set N2_ [hm_latestentityid nodes] *createmark lines 1 $Line3 *nodecreateonlines lines 1 1 0 0 set N3_ [hm_latestentityid nodes] *currentcollector comps [hm_getcollectorname comps $TargetComp] eval *createmark elems 1 $SourceElems *duplicatemark elems 1 1 *positionmark elems 1 $N1 $N2 $N3 $N1_ $N2_ $N3_ } } *clearmark all 1 }  
  2. Livil Lyle liked a post in a topic by vipin in Setting a Default Value   
    Hi @Bachelor22
     
    add default value after the string
    set youngs_modulus [hm_getfloat "Youngs Modulus (Steel)=" "Enter Youngs Modulus:" 210000]
  3. vipin liked a post in a topic by tinh in Deleting a Variable / Application Error   
    You have to set z = 0 before the loop "while"
     
  4. tinh liked a post in a topic by vipin in Setting a Default Value   
    Hi @Bachelor22
     
    add default value after the string
    set youngs_modulus [hm_getfloat "Youngs Modulus (Steel)=" "Enter Youngs Modulus:" 210000]
  5. Bachelor22 liked a post in a topic by vipin in Setting a Default Value   
    Hi @Bachelor22
     
    add default value after the string
    set youngs_modulus [hm_getfloat "Youngs Modulus (Steel)=" "Enter Youngs Modulus:" 210000]
  6. vipin liked a post in a topic by Livil Lyle in Closing of a   
    Hi,
     
    In your code,
     
    destroy .window11  
    will close the window. Not sure how to close it as soon as you enter a value. 
  7. vipin liked a post in a topic by tinh in Duplication of elements with different orientation   
    Hi, you should use *positionmark command
  8. Sagar Motwani liked a post in a topic by vipin in Hypermesh - Disable writing Command.tcl file through Code   
    Hi @Sagar Motwani,
    use  hm_commandfilestate 0
  9. vipin liked a post in a topic by sanket_patil in Get Name of component   
    @Yu-Ju Chen @sandeepballiwar I have used for loop and it is working good. 
     
  10. vipin liked a post in a topic by Livil Lyle in Implementation of a TCL-Script in HyperMesh   
    Hi Bachelor,
     
    I fixed the part to show up the dialog. Please find attachment. 
     
    convert.tcl
  11. vipin liked a post in a topic by tinh in Capture image with user orientation requirement ( node information based )   
    Using command *view iso1
    Before *window 0 0 0 0 0
  12. tinh liked a post in a topic by vipin in How to select a set of nodes on a vector defined by N1, N2, N3 and basepoint?   
    Hi Sathish,
     
    you can find a proc for vector normals from 3 nodes in following thread:
    https://forum.altair.com/topic/21893-how-to-create-a-normal-for-3-nodes/
    use the proc to find vector normals:
     
    set vecNormals [NormalFrmPlane $N1 $N2 $N3]
    set baseCords [lindex [hm_nodevalue $baseNode] 0]
     
    substitute these values in *createmark command :)
    *createmark nodes 1 "on plane" {*}$baseCords {*}$vecNormals 0.1 0 0
     
  13. Livil Lyle liked a post in a topic by vipin in How to select a set of nodes on a vector defined by N1, N2, N3 and basepoint?   
    Hi sathish,   you can use 'on plane' option in *createmark.   for example if you have base coordinates and vector normals, *createmark nodes 1 "on plane" $baseX $baseY $baseZ $normalX $normalY $normalZ 0.1 0 0 hm_getmark nodes 1
  14. Rahul R liked a post in a topic by vipin in Automated mass calc   
    Hi @paul_a,
     
    You can try a macro like this to save property information to csv file.
     
    set fpt [open [tk_getSaveFile -defaultextension .csv] w]
    puts $fpt "property name,mass"
    set allProps [hm_entitylist props name]
    foreach pName $allProps {
        *createmark elems 1 "by property name" $pName
        set temp [hm_getmass elems 1]
        set mass [lindex $temp 0]
        puts $fpt "$pName,$mass"
    }
    close $fpt
  15. vipin liked a post in a topic by paul_a in Automated mass calc   
    Vipin, thank you so much, this worked and saved me about 12 hours of repetitive clicking.
  16. vipin liked a post in a topic by Alex.01 in Beginning and ending of joints betwwen components   
    I really thank you guys, you helped me a lot.
  17. Pandurang liked a post in a topic by vipin in Select elements from a set of nodes   
    @tinh
    Tested all methods, last one runs faster on bigger assemblies (saves around 5 sec  ).
    Thanks again all!
  18. vipin liked a post in a topic by tinh in Beginning and ending of joints betwwen components   
    Hi
    If you don't find an "hm_" command to get these vertices:
    *features_advanced  (as vipin suggestion)
    *createmark elems 1 "by comp name" ^feature
    set NodeList [join [hm_getvalue elems mark=1 dataname=nodes]]
    array set Count {}
    set Vertices {}
    foreach NodeId $NodeList {
       if {[incr Count($NodeId)]>2} {lappend Vertices $NodeId}
    }
    puts $Vertices
     
     
    Before version 13 we don't have command "hm_getvalue", so looping through each element by tcl and get its nodes is quite long. at that time, to query such data i had to use an hm template to fasten script.
  19. Alex.01 liked a post in a topic by vipin in Beginning and ending of joints betwwen components   
    Hi Alex,
     
    Find shared nodes using hm_getnodessharedbyothercomps in mark 1, find edges and get all edge nodes in mark 2.
    Then get markintersection?!
  20. tinh liked a post in a topic by vipin in Select elements from a set of nodes   
    @tinh
    Tested all methods, last one runs faster on bigger assemblies (saves around 5 sec  ).
    Thanks again all!
  21. vipin liked a post in a topic by Roshan Shiveshwar in Select elements from a set of nodes   
    Just another way to handle this....
     
    *createmarkpanel nodes 1 "Select nodes to which the attached elements have to be determined"
    eval "*createmark elems 1 \"by nodes\" [hm_getmark nodes 1]"
    eval "*createmark nodes 2 \"by elems\" [hm_getmark elems 1]"
    *marknotintersection nodes 1 nodes 2
    eval "*createmark elems 2 \"by nodes\" [hm_getmark nodes 1]"
    *markdifference elems 1 elems 2
    set attached_elem_list [hm_getmark elems 1]
  22. vipin liked a post in a topic by akitoguc in Select elements from a set of nodes   
    Another solution you can try is the following:
    hm_createmark nodes 1 "by id only" $NodeList; hm_createmark nodes 1 advanced reverse; hm_createmark elems 1 "by nodes" [hm_getmark nodes 1]; hm_getmark elems 1;  
  23. vipin liked a post in a topic by tinh in Select elements from a set of nodes   
    Hi Vipin
    You can ignore adjacent elems
    *createmark nodes 1 {*}$NodeList
    *createmark elems 1 "by node" {*}[hm_getmark nodes 1]
    *createmark elems 1 reverse
    *appendmark elems 1 "by adjacent"
    *createmark elems 1 reverse
×
×
  • Create New...