Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

DoFileOpen return false when reading .stp or .step file in X7 SDK


Recommended Posts

Hello, this is Cheney from ISU.

 

We got this problem for developing MFC CHOOK when shifting from X6 to X7 SDK.

 

1. DoFileOpen(file,false,false,0)  function in X7 sdk always returns false when take .stp or .step files.

 

2.It works fine with .iges file. But the problem with taking in IGES file is , in mastercam x6 or x7 when calling the function wr_stl(0.001, stl_file, "", -1, truetrue); to save as .stl file, it always gives flipped normals on a triangulated polygon mesh. I am assuming that is some error within Mastercam.

 

If anyone knows how this happened and how to solve these problems?

 

Thanks in advance!

  • Like 1
Link to comment
Share on other sites

1. DoFileOpen(file,false,false,0)  function in X7 sdk always returns false when take .stp or .step files.

In a RELEASE Build of a X7 C-Hook ->
I use the DoFileOpen call on a .STP file and if that file exists and it is loaded, the return is TRUE.
When dealing with the non-native Import/Export type files, Release/Debug build can make a difference.
If you are running yor C-Hook in DEBUG, the required (Import/Export) McStep.DLL is not getting loaded and
the file will not get imported and the result you'll get is -> FALSE.
I am trying to recall how to setup X7 Debug so that you can "debug" with the SDK using the Import/Export types.
 
2.It works fine with .iges file. But the problem with taking in IGES file is, 
in mastercam x6 or x7 when calling the function wr_stl(0.001, stl_file, "", -1, true, true); to save as .stl file, 
it always gives flipped normals on a triangulated polygon mesh. 

I'm not sure what your procedure is here... taking IN and IGES, writing OUT an STL?
I'd need to have some sample file(s) showning "what is wrong" and the steps to reproduce this.
SDK <at> mastercam <dot> com

Link to comment
Share on other sites

To Roger:

 

Thanks for replying my question.

 

1. I started trying to figure out how to link MCSTEP.dll when running debug for X7 chook programs. If you recall how to link that, can you let me know? Thanks!

 

2.About the IGES to STL problem. In the released MasterCAM software when you open an IGES file and save it as ascii .stl. The saved stl will have flipped normals as the snapshot attached. Also, in the SDK when you call the function :wr_stl(0.001, stl_file, "", -1, truetrue); it gives the same result. This happens both in X6 and X7 and both in released MasterCam software and sdk.

 

Thanks and Best regard!

post-61584-0-19793000-1431711842_thumb.png

Link to comment
Share on other sites

To be able to debug a C-Hook project when using the Import/Export functionality for non-native file types.
You need to copy some files from the "product" install over to the Resouces folder where the C-Hook SDK is installed.

Example:

The X7 "product" is installed here...
D:\Program Files\mcamx7\resources

Copy all of the files from the ^above^ "Product" Resources folder over to where the C-Hook SDK is installed.
So that the x64\debug\Resources folder contains all the DLL files from the <mcamx7\resoources folder.

The C-Hook SDK for X7 is installed here...
D:\MASTERCAM\SDK\X7-MU1\x64\debug\Resources
 

  • Like 1
Link to comment
Share on other sites
I am not seeing an issue with the normal vectors in the STL file.

Your sample IGES contains a cube, where…

The vector on the “top” surface points “out” and the normal of all of the other sides point “in”.

To test, delete all but the Top & Bottom surfaces.

Export that data to an ascii STL file.

Now flip the surface normal on the bottom surface and export this out to another STL file.

Open both in an editor and you can see that the facet normal data in the original STL for both point +Z

The 2nd facet normal in the other STL (where you flipped the bottom surface), now points –Z.
Link to comment
Share on other sites

Thanks Roger,

 

I copied the dlls as you said, and it works now!

 

For the IGES files. I think Mastercam might read and create IGES file differently. Because those IGES file that I have tested are created from Solidworks and Creo, when open them in Mastercam and save as STL, they all show fliped normals. But when I create a model in Mastercam ->save it as IGES ->close Mastercam->open the IGES generated in Mastercam again-> save it as ascii STL. there is no flipped normals.

 

I will test it more and see how the IGES files are different. I am not sure where the problem comes from.

 

Anyway, thanks for your help Roger!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...