Question

Control quantity of surfaces for curved solids when reading DWG and writing OBJ?

  • 8 November 2017
  • 4 replies
  • 1 view

Badge

We are using FME to read DWG and write OBJ. OBJ only supports flat surfaces, so objects such as cylinders in the DWG are converted to flat surfaces in OBJ. Which DWG reader parameter I should look for to increase the number of flat surfaces written to the OBJ?

I have an existing fme workbench made by someone else, and I'm new to fme. Thanks much for any quick help from the community!


4 replies

Badge

Hi @rogerrapp,

I don't think this is possible... Not on the DWG Reader side nor the OBJ Writer side.

 

I don't have experience with DWG curved solids myself, so I'm not sure to which geometries they are converted by FME? Did you try already, or did you simply run a quick conversion from DWG -> OBJ? Either way, I am pretty sure that the geometry is triangulated into surfaces by the OBJ writer and not already by the DWG reader.

Unfortunately, you don't have any control over the OBJ writer triangulation process, but you could do it yourself in FME, so the OBJ writer will simply write out what you created. If those curved solids are read as extrusions created from an ellipse or arc, you could obtain that shape and convert it into a stroked circle polygon using an ArcStroker. Then, extrude it again and pass it through a Triangulator.

If you want, I could look into it for you (tomorrow... first need some sleep), if you have an example DWG for me!

Sander

Badge

Hi @Sander,

Thanks much for the quick reply! I appreciate your offer to take a look, and I've attached an example model file. Good luck and I'll be anxious to hear back!I suspect your premise is correct, that all decisions about replacement of curves with triangulated surfaces takes place in the OBJ writer. Since the writer doesn't support writing curved surfaces, I was hopeful a parameter would at least support controlling the number of flat segments used to depict them. Sadly, that doesn't appear to be the case, so I'll post an idea for that.To try and answer your questions, we have a workbench where DWG to OBJ conversions happen all day every day. And DWG to OBJ conversions have been fine so far. But we have some new use cases where improving the fidelity of curved surfaces is important. So I need to dig into this workbench (made by another) and try to add or fix what is needed. curvetest.zip
Badge

Hi @Sander,

Thanks much for the quick reply! I appreciate your offer to take a look, and I've attached an example model file. Good luck and I'll be anxious to hear back!I suspect your premise is correct, that all decisions about replacement of curves with triangulated surfaces takes place in the OBJ writer. Since the writer doesn't support writing curved surfaces, I was hopeful a parameter would at least support controlling the number of flat segments used to depict them. Sadly, that doesn't appear to be the case, so I'll post an idea for that.To try and answer your questions, we have a workbench where DWG to OBJ conversions happen all day every day. And DWG to OBJ conversions have been fine so far. But we have some new use cases where improving the fidelity of curved surfaces is important. So I need to dig into this workbench (made by another) and try to add or fix what is needed. curvetest.zip
Hi @rogerrapp,

 

I took a look at your file and I must admit I was wrong and you were right in this case. Although FME's OBJ writer does triangulate any geometry it does not support otherwise, the DWG reader is to blame here, as it (also) does not support these curved solids. Seems that elementary geometries (spheres, cylinders etc.) are supported as solids, but the file you sent me does not contain those. Have a look at this Data Inspector screendump:

 

 

Notice that the original entity type is an autocad_solid3d, but that it has been converted by FME into a multisurface (built-up of composite surfaces).

 

This means I'm not able to help you out, sorry..!

 

 

So, as for your idea, you might want to edit that so it's more inclusive, e.g. "add segmentation control when reader/writer does not support curved solids (and turns geometries into surfaces)". You already have my vote :)

 

By the way, even though it is a good idea, it would of course be better if FME simply left those solids intact! ;)

 

Badge

I've found a workaround - not optimal but should be acceptable in this particular case. It requires manually editing the DWG in AutoCAD (which isn't desirable). Essentially, the solution is to explode the solid to a surface, and convert the surface to a mesh - and in doing so, set the tessellations as high as desired using the AutoCAD MESHOPTIONS palette. There are plenty of steps in the process so I'll leave it at this for now unless anyone is interested in the details.

Thanks again for the desire and effort to help!

Reply