Segmentation Error in Hyperworks 2019

pat_20467
pat_20467 Altair Community Member
edited April 2022 in Community Q&A

Hi everyone,

I was wondering if anyone could help me identify what's causing the segmentation error?

I wrote a TCL Script as a test, the idea is to import a .dxf geometry, create solids then mesh them, then delete the model and import another .dxf to do the same thing.

However, Hyperworks always crashed during the meshing process of the 2nd geometry (I checked the crash0.hm file).

 

This seems to work when I did these manually, but running the script from command.tcl also produced a segmentation error at that exact spot.

Running it on a different computer didn't work either.

 

Thanks a lot in advance, would appreciate your help!

Tagged:

Answers

  • Ben Buchanan
    Ben Buchanan
    Altair Employee
    edited April 2022

    This probably doesn't have anything to do with the crash put it doesn't look like you are saving your model before you delete the first one.  Looking through the code nothing stands out as a problem.  I usually add puts statements in my code to see if I can narrow it down to the exact line where it is a problem.  This is a little hard with segmentation errors because you can't scroll up or look into it after put if you have the tcl console open you should be able to see the last puts statement that gets output before the window closes.

    Also I would suggest putting this in a loop.  Maybe create a list of all the files you want to do this for then do something like this:

    foreach dxfFile $fileList {

        <the code here

    }

    and I would probably add an export step.  Also I would get it working robustly for one file before I tried it for 2 or more files.

  • pat_20467
    pat_20467 Altair Community Member
    edited April 2022

    This probably doesn't have anything to do with the crash put it doesn't look like you are saving your model before you delete the first one.  Looking through the code nothing stands out as a problem.  I usually add puts statements in my code to see if I can narrow it down to the exact line where it is a problem.  This is a little hard with segmentation errors because you can't scroll up or look into it after put if you have the tcl console open you should be able to see the last puts statement that gets output before the window closes.

    Also I would suggest putting this in a loop.  Maybe create a list of all the files you want to do this for then do something like this:

    foreach dxfFile $fileList {

        <the code here

    }

    and I would probably add an export step.  Also I would get it working robustly for one file before I tried it for 2 or more files.

    Thanks for your answer!

     

    I did write a script using loops, but I'll try with foreach command too.

    The reason I wrote the previous script (crashtest) was because meshing the solid for the 2nd time seems to be the problem.

  • Ben Buchanan
    Ben Buchanan
    Altair Employee
    edited April 2022
    pat_20467 said:

    Thanks for your answer!

     

    I did write a script using loops, but I'll try with foreach command too.

    The reason I wrote the previous script (crashtest) was because meshing the solid for the 2nd time seems to be the problem.

    So you are getting a segmentation error with this script still?  If so I would try with each file individually to see if it is file specific or if it is an issue with the script in the second loop.
    Can you share the models?  Might be able to help a little more if I can test it on my end.

  • Ben Buchanan
    Ben Buchanan
    Altair Employee
    edited April 2022
    pat_20467 said:

    Thanks for your answer!

     

    I did write a script using loops, but I'll try with foreach command too.

    The reason I wrote the previous script (crashtest) was because meshing the solid for the 2nd time seems to be the problem.

    Do you know which line it crashes on?

  • pat_20467
    pat_20467 Altair Community Member
    edited April 2022

    Do you know which line it crashes on?

    The model unfortunately doesn't belong to me so I can't share it :(

    However the script does not depend on whether the model is there or not, so I commented the lines that open the model.

     

    It crashes on line 52 (testkombination.tcl) and line 42 (crashtest.tcl)

  • Ben Buchanan
    Ben Buchanan
    Altair Employee
    edited April 2022
    pat_20467 said:

    The model unfortunately doesn't belong to me so I can't share it :(

    However the script does not depend on whether the model is there or not, so I commented the lines that open the model.

     

    It crashes on line 52 (testkombination.tcl) and line 42 (crashtest.tcl)

    Try adding a *clearmarkall 1 and *clearmarkall 2 at the end of the loop or before the second attempt.

  • pat_20467
    pat_20467 Altair Community Member
    edited April 2022

    Try adding a *clearmarkall 1 and *clearmarkall 2 at the end of the loop or before the second attempt.

    It didn't work unfortunately :(

     

    I added them here:

    (testkombination)

    image

     

    (crashtest)

    image

  • Ben Buchanan
    Ben Buchanan
    Altair Employee
    edited April 2022
    pat_20467 said:

    It didn't work unfortunately :(

     

    I added them here:

    (testkombination)

    image

     

    (crashtest)

    image

    Another thing I sometimes try when debugging code is to copy the code into the tcl console one line at a time to see if you getting any errors.

    You could also to a puts statement to check if any of your marks are empty.

    It seems like it will be something with the marks since that is about all the input the *solidmap_solids_begin needs.  Made try clearing the mark in other spots too.  It is good practice to clear the mark once you no longer need it.  Sometimes setting the mark to a variable and then clearing is a good way to make sure you have the information when you need it but marks aren't interfering with each other.  You could also change some of them to use mark 2.

  • pat_20467
    pat_20467 Altair Community Member
    edited April 2022

    Another thing I sometimes try when debugging code is to copy the code into the tcl console one line at a time to see if you getting any errors.

    You could also to a puts statement to check if any of your marks are empty.

    It seems like it will be something with the marks since that is about all the input the *solidmap_solids_begin needs.  Made try clearing the mark in other spots too.  It is good practice to clear the mark once you no longer need it.  Sometimes setting the mark to a variable and then clearing is a good way to make sure you have the information when you need it but marks aren't interfering with each other.  You could also change some of them to use mark 2.

    I'll try that, thanks a lot for your help!

  • PaulAltair
    PaulAltair
    Altair Employee
    edited April 2022
    pat_20467 said:

    I'll try that, thanks a lot for your help!

    I don't have any dxf to try with, but I wonder if it is related to that reader, the dxf reader is quite old, I did something similar with step, and had no issues, my example step/tcl attached, it writes 2x hm files of the meshed solids, this was done in 2021 though, so may not work in your 2019 build.

  • pat_20467
    pat_20467 Altair Community Member
    edited April 2022

    I don't have any dxf to try with, but I wonder if it is related to that reader, the dxf reader is quite old, I did something similar with step, and had no issues, my example step/tcl attached, it writes 2x hm files of the meshed solids, this was done in 2021 though, so may not work in your 2019 build.

    Hey, thanks for your answer.

    May I ask how did you create the sketches as stp? I tried doing so with Autocad but Hypermesh didn't recognize it.

  • PaulAltair
    PaulAltair
    Altair Employee
    edited April 2022
    pat_20467 said:

    Hey, thanks for your answer.

    May I ask how did you create the sketches as stp? I tried doing so with Autocad but Hypermesh didn't recognize it.

    I just created those directly in HW, geometry ribbon, and exported from HW as STEP, I don't have a CAD package

  • Ben Buchanan
    Ben Buchanan
    Altair Employee
    edited April 2022
    pat_20467 said:

    Hey, thanks for your answer.

    May I ask how did you create the sketches as stp? I tried doing so with Autocad but Hypermesh didn't recognize it.

    I have found Inspire Studio does a good job of reading in CAD that HW won't and then you can export from Inspire Studio and then it will usually read into HW.