How to mesh or cut surface by component name

ve3D
ve3D Altair Community Member
edited October 2020 in Community Q&A

 

Hello,

I would like looking for the code to be able to mesh according to the name of the component. For example when I do automatic mesh for the component named 'NIV1_D0700', I got the code in the command.tcl file as below:

*startnotehistorystate {Automesh elements}

*setedgedensitylinkwithaspectratio -1

*elementorder 1

*setusefeatures 3

*createmark elements 1 1-56 3845-3910

*defaultremeshelems 1 0.4 4 4 1 1 1 1 0 0 0 0 2 30

*setusefeatures 0

*endnotehistorystate {Automesh elements}

 

It gives the ID numbers (red color) and not the name of the component, so I can not copy the code. I would like a line of code as below for example:

*startnotehistorystate {Automesh elements}

…..

*createmark components 3 'NIV1_D0700'

…..

*endnotehistorystate {Automesh elements}

 

In the same way, when I want to cut a surface by two points 'F11', Hypermesh generates a command with ID (red color) but not with component name. If I have a component with several elements (several id), Can I call only the component to make the cut. I asked the question because every time I corrected the geometric model in another software and import it again, the id of all elements are changed, the codes are no longer valid.

 

*createnode 20.5 30.15 -13.78 0 19 120268

*createnode 20.5 29.25 -13.78 0 19 66021

*mergehistorystate '' ''

*surfacesplitwithcoords 19 20.5 30.15 -13.78 20.5 29.25 -13.78

*mergehistorystate '' ''

  

Someone can help me?

 

Thanks in advance,
Best regards,


 

 

 

Tagged:

Answers

  • tinh
    tinh Altair Community Member
    edited May 2018

    you can select elems 'by comp name'

    *createmark elems 1 'by comp name' NIV1_D0700

  • ve3D
    ve3D Altair Community Member
    edited May 2018

    Thanks a lot @Tinh

     

    I arrived to mesh several surfaces by code:

    *setedgedensitylinkwithaspectratio -1
    *elementorder 1
    *createmark surfaces 1 'by comp name' 'NIV1_D0700' 'NIV1_D1000' 'NIV1_D2000'
    *defaultremeshsurf 1 0.5 4 4 2 1 1 1 1 0 0 0 0

     

    But I did not arrive to cut a surface 'F11' by two points with the same principe :

     

    *createnode 20.5 30.15 -13.78 0 19 120268
    *createnode 20.5 29.25 -13.78 0 19 66021
    *mergehistorystate '' ''
    *createmark surfaces 1 'by comp name' 'NIV1_D2000'
    *surfacesplitwithcoords 1 20.5 30.15 -13.78 20.5 29.25 -13.78
    *mergehistorystate '' ''

     

    Do you know how to do it?

     

     

  • tinh
    tinh Altair Community Member
    edited May 2018

    input argument for *surfacesplit is surf ID but not mark 1

    just 1 surf can be splitted per step so you have to input surf ID (number 19 can be retrieved by:

    *createmark surfs 1 'by comp name' NIV1_D2000

    set surfID [lindex [hm_getmark surfs 1] 0]

     

  • ve3D
    ve3D Altair Community Member
    edited November 2020

     

    Hi,

    I tried to do as your explanation, but it does not work. I received the message 'unable to split the surface'

    *createmark surfs 1 'by comp name' 'NIV1_D2000'
    set surfID [lindex [hm_getmark surfs 1] 0]
    *createnode 20.5 30.15 -13.78 0 19 120268
    *createnode 20.5 29.25 -13.78 0 19 66021
    *mergehistorystate '' ''
    *surfacesplitwithcoords surfID 20.5 30.15 -13.78 20.5 29.25 -13.78
    *mergehistorystate '' ''

     

    Can you try it with the attached file please?

     

    Thank you in advance

    Unable to find an attachment - read this blog

  • tinh
    tinh Altair Community Member
    edited May 2018

    Hi

    error is at this

    surfacesplitwithcoords surfID

     

    must be: surfacesplitwithcoords $surfID

  • ve3D
    ve3D Altair Community Member
    edited May 2018

    HI @tinh

    It works, thanks very much for your help

     

    Best regard

     

  • ve3D
    ve3D Altair Community Member
    edited August 2018

    Hi @tinh

     

    Does this method work when there are multiple surfaces in the same 'component' ?  

     

    In fact,  I would like to do an automatic macro to cut the floor in several areas between two feet of the doors as the figure below. To do this manually, I have to use F11 and choose every couple of points for each foot of the doors. Hypermesh gives me commands and coordinates as below:

     *surfacesplitwithcoords 18 15.55 33.9 -13.78 15.55 33 -13.78

    *surfacesplitwithcoords 10 15.55 18.2 -13.78 15.55 17.3 -13.78

    *surfacesplitwithcoords 17 23.6 8.15 -13.78 25 8.15 -13.78

    I can paste these lines on the * .tcl file and run it. The problem is that when I modify some geometry in the * .igs files in the CAD software, the ID numbers of the surfaces (18, 10, 17) will be modified in Hypermesh. The macro does not work anymore.

     

    Your method allows giving the surface corresponding to the component 'NIV1_D2000'. But when the component 'NIV1_D2000' has several surfaces, how can we find the surface numbers (18, 10, 17) of the different areas of the component 'NIV1_D2000' to use the command *surfacesplitwithcoords ?

     

    You will find  in attached zip all the files concerning the inputs * igs (it is necessary to change the path) and the file * .tcl that I can not run using your method.

     

    It's too bad that the command * surfacesplitwithcoords is based only on surfaces and not on components

     

    Thank you very much,

     

    Best regard

     

    image.png.b1bfd43151648dd5ff55ad0489b304b7.png

     

  • tinh
    tinh Altair Community Member
    edited August 2018

    Yes it accepts surf id as input arg but not surf mark

    Given a coordinate, you can find the closest surf id by hm_measureshortestdistance2

    And then use that id for *surfacesplitwithcoords

  • ve3D
    ve3D Altair Community Member
    edited August 2018

    Hi @tinh,

     

    I tried for example, but it is always 'Unable to split the surface':

     

    set surfID [lindex [hm_measureshortestdistance2 15.55 33.9 -13.78 surfaces 1 0 0] 5]
    *surfacesplitwithcoords $surfID 15.55 33.9 -13.78 15.55 33 -13.78

     

    According to the help, the return is a list of values: d dx dy dz id x y z

    So to take the 5th element (ID) in the output list, il tried:

    set surfID [lindex [hm_measureshortestdistance2 15.55 33.9 -13.78 surfaces 1 0 0] 5]

    Is that correct ?

     

    Thanks

     

  • ve3D
    ve3D Altair Community Member
    edited August 2018

    Hi @tinh

     

    I found the problem, in the list d dx dy dz id x y z, to have ID, we must take 4

    set surfID [lindex [hm_measureshortestdistance2 15.55 33.9 -13.78 surfaces 1 0 0] 4]

     

    So the first item is '0' as in python, and the 5th element is '4' ?

     

    d dx dy dz id x y z

    • d – The value of the shortest distance
    • dx – The x value of the shortest distance, measured relative to the specified local system
    • dy – The y value of the shortest distance, measured relative to the specified local system
    • dz – The z value of the shortest distance, measured relative to the specified local system
    • id1 – ID of the closest entity from the mark
    • x1 y1 z1 – Coordinates of the closest location on entity id1