Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations JAE on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Corrupt STL Export - NX Journaling

Status
Not open for further replies.

AnAngryScotsman

Aerospace
Joined
Oct 15, 2019
Messages
8
Location
SE
Hello,

I have a complex part which resembles a kayak (attached), I have a python journalling script which changes some dimensions and suppresses/unsuppresses some features, then exports an STL of the part + JSON file with the parameters used.

When I manually export an STL it has no errors, but all of the STL files (3500 of them) which have been created by my code will not open - giving me Error Code: 0x80004005 from the default windows app. These files are also used in a web app, and they will not display their either. However, they appear to have a file size, so must contain something - I have managed to get it to work by running identical code (copy + paste) on the same master part file and it has opened with no issues.

Any ideas on how to fix this or what could have caused it? I need these files to work urgently, so many help is really appreciated.

I have attached the master file, one of the generated STL files, a screenshot of the error code.

Here is a link to the GitHub repository for the code:
Link

Thank you.

Error_rhzcrs.png


STL Link: Part Link:
 
When you output the files manually, are you using the "binary" or "text" output option? I think the STLCreator will default to binary unless you explicitly tell it to use text output.

What version of NX are you using?

www.nxjournaling.com
 
I'm not sure, this is the code for my STL_save function:

Code:
markId10 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "STL Export")

        # STL set up:
        sTLCreator1 = theSession.DexManager.CreateStlCreator()
        sTLCreator1.AutoNormalGen = True
        sTLCreator1.ChordalTol = 0.080000000000000002
        sTLCreator1.AdjacencyTol = 0.080000000000000002

        # Output path:
        sTLCreator1.OutputFile = f"F:\\CAD WORKING DIRECTORY\\NEW STORAGE\\STL STORAGE\\Kayak_{str(value1)}.stl"

        # Adding Bodies to STL export:
        objects1 = [NXOpen.NXObject.Null] * 13
        body1 = workPart.Bodies.FindObject("EXTRUDE(78)")
        objects1[0] = body1
        body2 = workPart.Bodies.FindObject("EXTRUDE(46)")
        objects1[1] = body2
        body3 = workPart.Bodies.FindObject("EXTRUDE(71)")
        objects1[2] = body3
        body4 = workPart.Bodies.FindObject("EXTRUDE(106)")
        objects1[3] = body4
        body5 = workPart.Bodies.FindObject("EXTRUDE(54)")
        objects1[4] = body5
        body6 = workPart.Bodies.FindObject("EXTRUDE(44)")
        objects1[5] = body6
        body7 = workPart.Bodies.FindObject("EXTRUDE(52)")
        objects1[6] = body7
        body8 = workPart.Bodies.FindObject("EXTRUDE(100)")
        objects1[7] = body8
        body9 = workPart.Bodies.FindObject("EXTRUDE(60)")
        objects1[8] = body9
        body10 = workPart.Bodies.FindObject("EXTRUDE(92)")
        objects1[9] = body10
        body11 = workPart.Bodies.FindObject("EXTRUDE(62)")
        objects1[10] = body11
        body12 = workPart.Bodies.FindObject("EXTRUDE(43)")
        objects1[11] = body12
        body13 = workPart.Bodies.FindObject("EXTRUDE(45)")
        objects1[12] = body13
        added1 = sTLCreator1.ExportSelectionBlock.Add(objects1)

        nXObject1 = sTLCreator1.Commit()
        sTLCreator1.Destroy()

        nErrs10 = theSession.UpdateManager.DoUpdate(markId10)

This was created based on a journal recording using the default settings to export an STL - should be the same way as was done manually. I am using SIEMENS NX 12.0
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top