Jump to content
Mr. Wilson Wang

Export IGES

Recommended Posts

Simple question.  

 

What type does it support?  surface? line? 

 

When I tried to import iges file, I found it takes huge memory. How can I make it better? I did not do any transformation and I think the computer would crash.

if(!In.exists())
  echo("Invalid input file, file does not exist.")
  break()
endif

igesDeprecatedImport importer()
importer.import(In.getFileName())
objectlist imported(importer.getLastImportedObjects())
surfacegroup ShipSurf()
unsigned i(0)

while(i<imported.getCount()-1)
   ShipSurf.addEntities([imported.at(i).castTo(FBSplineSurface)])
   i+=1
endwhile

Share this post


Link to post
Share on other sites

Hey Wilson,

 

The iges import supports surfaces , curves and points.

The surfaces are imported as NURBS surfaces. You are casting it to FBSPLINE surfaces.

Try the following code:

if(!In.exists())
  echo("Invalid input file, file does not exist.")
  break()
endif

igesDeprecatedImport importer()
importer.import(In.getFileName())
objectlist imported(importer.getLastImportedObjects())
surfacegroup ShipSurf()

foreach(FSURFACE surf in imported)
   ShipSurf.add(surf)
endfor

Information about foreach can be found in the FDefineFeatureDlg documentation in CAESES or in the document in this post.

 

Cheers,

 

Karsten

Share this post


Link to post
Share on other sites

Hi, Karsten

 

It is working!! Thanks a lot. 

 

One more question: how can I export an imagesurfacegroup as Iges? Does foreach can take the job?

 

Best wishes

 

Hey Wilson,

 

The iges import supports surfaces , curves and points.

The surfaces are imported as NURBS surfaces. You are casting it to FBSPLINE surfaces.

Try the following code:

if(!In.exists())
  echo("Invalid input file, file does not exist.")
  break()
endif

igesDeprecatedImport importer()
importer.import(In.getFileName())
objectlist imported(importer.getLastImportedObjects())
surfacegroup ShipSurf()

foreach(FSURFACE surf in imported)
   ShipSurf.add(surf)
endfor

Information about foreach can be found in the FDefineFeatureDlg documentation in CAESES or in the document in this post.

 

Cheers,

 

Karsten

Share this post


Link to post
Share on other sites

Hey Wilson.

 

For the iges export it depends a bit but this would export all surfaces which are in the list surfaces.

igesExport exporter()
imagesurface img()

objectlist surfaces()

surfaces.add(img)

exporter.add(surfaces)

string filepath(resolveenv("$PROJECTDIR")+"/export.iges") // iges file will be saved in the project directory.

exporter.export(filepath)

for an imagesurfacegoup:

igesExport exporter()

surfacegroup group()
imageSurfaceGroup imggroup(group)

exporter.add(imggroup)

string filepath(resolveenv("$PROJECTDIR")+"/export.iges")

exporter.export(filepath)

I am pretty sure you can change the feature code to your needs.

 

Cheers,

 

Karsten

Share this post


Link to post
Share on other sites

Thank you so much, Karsten.

 

I've tried this code. But some problems occured and iges file equals to null. I've considered some that can be the problems as followed:

 

1. It shows warning "*** INFO IGES Import : entity type warning [detected type 406 is unsupported]" when I import the original IGES file. The iges file comes from Rhino. 

 

2. The console also shows *** INFO IGES Export : processing [exporting 1 object(s)] when file is exported and the exporter.iges is null. However when I've tried to export the original surfacegroup as Iges, it shows *** INFO IGES Export : processing [exporting 3354 object(s)] and exported that successfully.

 

3. I've also tried to convert the imagesurfacegroup to another surfaceGroup and export it , unfortunately, the program crashed when exporting(or running).

 

Best wishes

Hey Wilson.

 

For the iges export it depends a bit but this would export all surfaces which are in the list surfaces.

igesExport exporter()
imagesurface img()

objectlist surfaces()

surfaces.add(img)

exporter.add(surfaces)

string filepath(resolveenv("$PROJECTDIR")+"/export.iges") // iges file will be saved in the project directory.

exporter.export(filepath)

for an imagesurfacegoup:

igesExport exporter()

surfacegroup group()
imageSurfaceGroup imggroup(group)

exporter.add(imggroup)

string filepath(resolveenv("$PROJECTDIR")+"/export.iges")

exporter.export(filepath)

I am pretty sure you can change the feature code to your needs.

 

Cheers,

 

Karsten

Share this post


Link to post
Share on other sites

Hey Wilson,

 

1. The IGESdeprecated does not support all types of iges types. It does not support trimmed surfaces at all.

For the import use genericimport instead of igesimportdeprecated .

 

2. Okay .... Take a look at the attached feature definition. IgesExport.fdf

igesExport exporter()

imagesurfacegroup imggroup(group) // group is an argument of type surfacegroup
exporter.add(imggroup.getSurfaceGroupFromImage()) // .getSurfaceGroupFromImage() is solving the export of only one object. 

string filepath(resolveenv("$PROJECTDIR")+"/export.iges") // iges file will be saved in the project directory.

exporter.export(filepath)

3. The crash shouldn't happen. Have you done that in a feature definition or in the object editor?

 

I've attached the reviewed loops tutorial which will be in the upcoming release which is using the other igesimport.

 

Cheers,

 

Karsten

03_Loops.pdf

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...