Rvit Plan View custom export (DWFx or SVG, etc.)

Rvit Plan View custom export (DWFx or SVG, etc.)

Anonymous
Not applicable
10,661 Views
10 Replies
Message 1 of 11

Rvit Plan View custom export (DWFx or SVG, etc.)

Anonymous
Not applicable

Hello my name is Daniel, am researching Printing and Export process.

 

My questions are:

1. How does the export to DWFx work?

2. Is the process simply exports all visible elements on plan view (Geometry, Annotation, etc.), or is there a more

complicated process such as printing preprocessing?

 

The reason I’m asking is, what if I would like to create my own Plan View export, for example to SVG or

Some other XML based format of my own creation. With complete detail information (Annotations, etc).

Do you think that would be possible? Or maybe there is an API similar to IFC exporter that may be available

In the future?

 

Thank you for your time.

 

 

Daniel

0 Likes
Accepted solutions (1)
10,662 Views
10 Replies
Replies (10)
Message 2 of 11

jeremytammik
Autodesk
Autodesk
Accepted solution

Dear Daniel,

 

Thank you for your query.

 

There are a lot of answers to this.

 

1. How does the export to DWFx work?

 

The first answer is simple, and applies to most of the Revit API:

 

The Revit API export to DXFx works exactly the same way as the user interface functionality.

 

Call the Document.Export method overload taking a DWFXExportOptions argument to exports the current view or a selection of views in DWFX format.

 

For examples, please look at the Revit SDK and The Building Coder blog, e.g.

 

http://lmgtfy.com/?q=building+coder+dwf+export

 

2. Does it simply exports all visible elements on plan view?

 

It exports exactly what you see in the view. You can set up the view to export what you want. This includes annotation and also sections:

 

http://thebuildingcoder.typepad.com/blog/2011/08/section-view-geometry.html

 

3. I would like to create my own Plan View export, for example to SVG or some other XML based format.

 

You can look at my simplified 2D BIM room editor for a very complete example of exporting 2D to SVG:

 

http://lmgtfy.com/?q=building+coder+room+editor

 

For a full 3D export to JSON, you can look at what we achieved last weekend at the AEC Hackathon in New York:

 

 

We won second prize!

 

I hope this helps.

 

Best regards,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 11

Anonymous
Not applicable

 

> 3. I would like to create my own Plan View export, for example to SVG or some other XML based format.

 

> You can look at my simplified 2D BIM room editor for a very complete example of exporting 2D to SVG:

 

> http://lmgtfy.com/?q=building+coder+room+editor

 

Where you can see on the code file in SVG?

0 Likes
Message 4 of 11

jeremytammik
Autodesk
Autodesk

3a. Clone the source code from GitHub:

 

https://github.com/jeremytammik/RoomEditorApp

 

3b. Load the solution file in Visual Studio.

 

3c. Search globally for "svg".

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 5 of 11

Anonymous
Not applicable

I do not use Visual Studio.

would like to see the code example as

 

<svg ...>

  <defs ...> ... </defs>

...

</svg>

0 Likes
Message 6 of 11

jeremytammik
Autodesk
Autodesk

If you do not use Visual Studio, you can simply download the code and search through the text in the C# source code.

 

What I do is trivial.

 

All I do is populate the "d" attribute defining the data of the SVG path tag:

 

http://www.w3.org/TR/SVG/paths.html#PathData

 

Here is an example of the code generating an (X, Y) tuple to append to the SVG path "d" attribute for a given 2D point:

 

  /// <summary>
  /// Return a string suitable for use in an SVG 
  /// path. For index i == 0, prefix with 'M', for
  /// i == 1 with 'L', and otherwise with nothing.
  /// </summary>
  public string SvgPath( int i )
  {
    return string.Format( "{0}{1} {2}",
      ( 0 == i ? "M" : ( 1 == i ? "L" : "" ) ),
      X, Util.SvgFlipY( Y ) );
  }

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 7 of 11

Anonymous
Not applicable

I'm interested in the end result in xml (svg) that you can use in other CAD systems.

0 Likes
Message 8 of 11

jeremytammik
Autodesk
Autodesk

Good luck to you!



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 9 of 11

jeremytammik
Autodesk
Autodesk

Here is a new absolutely minimal sample showing how to generate an SVG representation of a room boundary and send it to an external Heroku-hosted node.js web server for display:

 

http://thebuildingcoder.typepad.com/blog/2015/04/sending-a-room-boundary-to-an-svg-node-web-server.h...

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 10 of 11

BIAL_prakash.p
Explorer
Explorer

Hi,

 

I want to export SVG format Revit Rooms & boundary , how to use your add in revit 2019

 

Thanks

Prakash Pisipati

 

0 Likes
Message 11 of 11

jeremytammik
Autodesk
Autodesk

Recompile for Revit 2019, install and launch the external command, just like any other command:

 

https://thebuildingcoder.typepad.com/blog/about-the-author.html#2

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes