Noob question - exporting DXF with meshes

Hi there,

I’m new to rhino and have a question about converting a 3dm model into a DXF model. I’ve figured out how to load the model and can view it, and I’ve figured out how to export the model as a DXF file, but all of the surfaces appear to be SPLINEs rather than MESHes as I was expecting/hoping. I’m trying to puzzle through the various export options and am not quite sure how to go forward.

I chose a surface at random from the 3dm model, looked at the properties->details and see this:

surface  
  
  ID: 26817bb7-f8c0-45c3-8718-5224a32d741e (132159)
  Object name: (not named)
  Layer name: Buildings::RoofTop Surface
  Render Material: 
    source = from layer
    index = -1
  
  Geometry:
    Valid surface.
    trimmed surface.
      Plane Surface
        "U":  (-1184.9 <= U <= 22.2594)
        "V":  (-153.134 <= V <= 1.51618)
  Edge Tally:
      3 boundary edges
  Edge Tolerances: 0 to 0.000149158
    median = 5.37682e-09 average = 4.97211e-05
  Vertex Tolerances: all 0
  Render mesh: 1 mesh  5 vertices  3 polygons
    Created with fast meshing parameters.
  Analysis mesh: none present

This appears as best I can tell to already be a mesh (render mesh: 1 mesh, 5 vertices, 3 polygons). That’s what I’m hoping to see exported in the DXF file, and then I suspect I can figure out the rest from there.

I’m still working to understand how rhino works and represents things, so this may be a RTFM problem… but there’s a lot there to sift through, so hoping someone might have some pointers on what to look for or what concepts to go read about in more detail. I’m suspecting that I need to either go through some sort of conversion process within rhino from one format/representation to a mesh representation, and then export from there…? Or it may be with the appropriate export scheme selection, I’ll get what I’m looking for. (I tried Default scheme and 2007 Solid… I’m not sure what solid gave me, but it appeared to be some code - perhaps it was g-code for a mill? idk.)

For some context, my end goal is to convert this version of a New York City building model from 3dm to DXF with meshes for the surfaces.

https://www1.nyc.gov/site/planning/data-maps/open-data/dwn-nyc-3d-model-download.page

I’ve figured out how to load a similar DXF building model file from cadmapper.com into my code (python), so my thought is that if I can convert the NYC open data model to mesh format, I might be able to use that as well.

For additional context, the reason I think I need meshes is that I’m reading in the DXF file, extracting the meshes, performing triangulation on the meshes, and rendering the triangles in Open GL. (This isn’t terribly relevant to the question, but might help shape the answer? "Did you think about… " etc.) I understand conceptually a DXF file with meshes and have a pipeline built up around that (in python), but I’m not quite sure what to do with splines because (in my head) they represent a curved line, not a closed polygon, so I’m not quite sure what I would do with them or how I would go about triangulating them.

Additional background – I’m a student, I have a simulation and visualization environment built up in python where I can load the DXF file (with meshes), perform my simulations in it, and then view the output in Open GL. If I can get past this stumbling point, then I should be able to run my simulations within these building models, which would be kind of fun.

I’ve also been searching the forum here, finding entries that get close to what I’m looking for, but I haven’t had any success trying to apply them. Example post:

That one is especially relevant as it is discussing mesh from surface. From this, I also tried selecting a surface in rhino, selected Mesh->From NURBS Object, default number of polygons. This resulted in a what looks like a triangulated polygon visible in rhino. I went back, selected the mesh objects in rhino, File->Export Selected, then exported as DXF with default Scheme. I thought I was on the right track as the output indicated that 1 Mesh was exported, but when I inspect the DXF file, I see that it is a POLYLINE rather than a mesh. So I think this is probably the right direction, but I haven’t figured out how to manipulate rhino to get what I’m looking for.

Thanks in advance for any pointers in the right direction.

J.

This appears to be user 1339’s fundamental “question”: He exported a mesh from Rhino as a DXF file but the resulting DXF file appears to contain polylines, not a mesh.

For @user1339 : A .3dm file with an example of a mesh you want to export and the .dxf file you create using that mesh would be helpful to someone trying to assist you. You can create the .3dm file using Export and selecting the geometry to be exported. To upload files you can click on the vertical arrow icon above where you type your post.

NRUBS surfaces and polysurfaces in Rhino use associated meshes for display purposes, but the surface and polysurfaces remain in NURBS form. As you found you can use the Mesh from NURBS objects command to create/extract a mesh from a NURBS surface. Then export the mesh if a mesh is desired.

Here is an example file and the results of conversion:

Selected a single building from the NYC building data, saved just that to a 3DM file.
single_building.3dm (7.5 MB)

Selected all objects, Mesh → From NURBS Object. Chose minimal number of polygons. Selected original objects and removed them; this file should contain only the meshes.
single_building_only_meshes.3dm (3.9 MB)

From that file, selected all objects (meshes), File->Export. Selected DXF file format. Unchecked ‘Save plugin data’. Selected Export Scheme “Default”.

single_building_only_meshes.dxf (2.3 MB)

If you inspect the resulting DXF file with a text editor, you’ll see that it has POLYLINE objects rather than MESH objects.

I’m hoping to obtain mesh objects that look like the following. (Taken from a different file.)

  8422 MESH
  8423   5
  8424 147b
  8425 330
  8426 1F
  8427   100
  8428 AcDbEntity
  8429 8
  8430 buildings
  8431   100
  8432 AcDbSubDMesh
  8433 71
  8434 2
  8435 72
  8436 0
  8437 91
  8438 0
  8439 92
  8440 12
  8441 10
  8442 573.1068
  8443 20
  8444 459.7205
  8445 30
  8446 88.4689
  8447 10
  8448 575.3194
  8449 20
  8450 451.9101
  8451 30
  8452 88.4689
  8453 10
  8454 577.5105
  8455 20
  8456 444.1274
  8457 30
  8458 88.4689
  8459 10
  8460 606.2630
  8461 20
  8462 453.4781
  8463 30
  8464 88.4689
  8465 10
  8466 600.6730
  8467 20
  8468 476.9304
  8469 30
  8470 88.4689
  8471 10
  8472 570.5475
  8473 20
  8474 468.7646
  8475 30
  8476 88.4689
  8477 10
  8478 573.1068
  8479 20
  8480 459.7205
~ snip ~

J.

And an even simpler reproducer with same results:

box.3dm (2.6 MB)
box.dxf (163.4 KB)

J.

Your “Single building” is 22 surfaces. However you have a couple of thousand other surfaces and curves in the file. I deleted those.

You can select the 22 surfaces and use Join to join them into one polysurface. It’s open, but that’s because there is a small gap. Won’t worry about that for now.

SingleBldgJoined.3dm (135.9 KB)

I meshed that building to get this - a single open mesh with 52 faces.

SingleMesh.3dm (49.8 KB)

I exported that as DXF, 2007 Natural scheme (Default scheme will also work).

SingleBuildingMesh.dxf (190.6 KB)

Importing the DXF back into Rhino I get - 1 open mesh.

Hi,

While it’s great that you were able to do that as it’s clearly a better representation of the building with fewer polygons, it isn’t really what I was asking. The reason that file had so much extra stuff in it is I took the original several hundred megabyte file with buildings for “all” of NYC and tried in rhino to remove everything but the polygons for one building. Looks like I missed some items, maybe in a layer that wasn’t visible. Dunno and doesn’t really matter. (The cube that I uploaded shouldn’t have any extra cruft in it so should be easier to look at.)

I guess I’m trying to understand how to control the DXF generation so that MESH entries are generated, if that’s possible.

http://help.autodesk.com/cloudhelp/2018/ENU/AutoCAD-DXF/files/index.htm

In other news, reading through the DXF spec (link above) more I see now that rhino is generating a PolyMeshFace which is a subclass of a POLYLINE. (Doesn’t make much sense to me either, but that’s DXF.) I’m starting to figure out how to parse out the faces and vertices from what rhino is generating, but would still be helpful if could just generate MESH entries as they are simpler.

Hopefully that clarifies what I’m asking about.

J

1 Like

But that is exactly what it is doing. The .dxf I posted above contains one mesh. Exported from your Rhino object.

Rhino apparently exports meshes to a .dxf file as a “PolyFaceMesh” type of object. user1339 wants it as a “Mesh” type of object.

It appears that when importing a .dxf file Rhino interprets a .dxf “PolyFaceMesh” object as a mesh.

Thanks, David, that’s right.

Rhino is not wrong to export it as a PolyFaceMesh - I’m just hoping I can get the simpler Mesh out of rhino. May not be possible.

J.

What is the mesh command in AutoCAD?

Creates a 3D mesh primitive object such as a box, cone, cylinder, pyramid, sphere, wedge, or torus. Find. The basic mesh forms, known as mesh primitives, are the equivalent of the primitive forms for 3D solids. You can reshape mesh objects by smoothing, creasing, refining, and splitting faces

This sounds more like a Sub-D type object to me.

What is a polyface mesh in AutoCAD?

AutoCAD has a polyface mesh entity (PFACE comand) which is capable of describing a mesh object, something that other CAD systems usually call “polygon mesh”. Basically a collection of triangle and/or quad faces connected to each other by common vertices. … The polyface mesh entity cannot have more than 32,767 vertices

This sounds like a polygon mesh. The vertex count limitation sounds odd - what happens when you try to import a larger polygon mesh into ACAD? It gets broken into several objects?

The question to be asked here is - what is the end goal? Why do you need an ACAD Mesh object over a PolyfaceMesh object for your purposes?

The DXF ACAD Mesh objects are a lot easier to parse. The PolyFaceMesh objects are much more complex and difficult to read from the file. (I go into that in more detail in the posts above, but that’s the gist.)

I’m suspecting the outcome of this thread will be that rhino can export to DXF, but it uses the more complex PolyFaceMesh to do so.

J.

Rhino definitely can export DXF format files. It also appears to use the PolyFaceMesh format for meshes.

DXF’s can come from many sources, not just Rhino. I’m willing to bet, especially as concerns land use/building information, that the dxf’s will be almost universally written with polyface meshes. For example here is an extract from the local SwissBuildings register in the form of .dxf.

Here is the .dxf file if you wish to look at it - note it has not gone through Rhino, it is a direct download from the government geodata website here.

swissbuildings3d_2_2021-09_1244-34_2056_5728.dxf.zip (5.1 MB)

I almost have PolyFaceMesh parsing working. I’ll just go down that route. Thanks for the help and wisdom, all!

J.