Importing faces rather than triangles

Hello, I’m new to SketchUp SDK and modelling in general. I’m working on an existing piece of code which converts .xml to .skp. The program exports by triangles and I’m wondering if there is a way to export it by faces / meshes instead? Thanks!

What program ?

In the first sentence, you are speaking of import (into SketchUp ?)

In the second sentence, you are speaking of export, but from what ?

Any chance the XML is actually Collada? Can you post a link to an example file?

If it is Collada you should be able to import that straight into SketchUp.

By program I mean the code which converts .xml to .skp - it was written by a previous intern who has left and I’m the new intern working on the code.
And sorry, I meant import by triangles. Import into SketchUp.

You could start here:

Have you studied the two sample projects that come with the SDK ?

EDIT (add): The one that should interest you should be in:

Here’s an example. The right block is the original model. The left block is what I get after 2 conversions, i.e. .spk to .xml then back to .spk, just for proof of concept. As you can see, the left block is triangulated. Is there a way to make the end product not triangulated when converting .xml to .skp?

Well look at this simple example. It creates a face using 4 vertices not 3.

< EDIT: Example no longer available. Examples are supplied within SDK archive. >

And make sure the code is not using this:

Other than that, you need to search for a “Merge Coplanar Faces” feature, example, plugin, etc.

Hi @lin_b ,

My memory is a bit fuzzy but I think we export tessellated faces in the xml exporter. So when you import it back, you get triangulated faces back. These were just SDK examples, that we honestly put together very fast. Complete round-trip model fidelity was not a big priority. And code quality isn’t exactly great either :grinning:

If you modified the code to export the original face vertices, you’d get the original faces back after the import.

I hope that helps.

1 Like

I have the same requirements when importing STL file and other files formats as SketchUp file. It seems there is an existing API “SU_RESULT SUModelMergeCoplanarFaces(SUModelRef model);” provided to merge the co-planar faces.