Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

10 REPLIES 10
SOLVED
Reply
Message 1 of 11
Anonymous
9709 Views, 10 Replies

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

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

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

10 REPLIES 10
Message 2 of 11
jeremytammik
in reply to: Anonymous

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

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
in reply to: jeremytammik

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

 

> 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?

Message 4 of 11
jeremytammik
in reply to: Anonymous

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

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

Message 5 of 11
Anonymous
in reply to: jeremytammik

Anonymous
Not applicable

I do not use Visual Studio.

would like to see the code example as

 

<svg ...>

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

...

</svg>

0 Likes

I do not use Visual Studio.

would like to see the code example as

 

<svg ...>

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

...

</svg>

Message 6 of 11
jeremytammik
in reply to: Anonymous

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

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

Message 7 of 11
Anonymous
in reply to: jeremytammik

Anonymous
Not applicable

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

0 Likes

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

Message 8 of 11
jeremytammik
in reply to: Anonymous

jeremytammik
Autodesk
Autodesk

Good luck to you!



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

0 Likes

Good luck to you!



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

Message 9 of 11
jeremytammik
in reply to: Anonymous

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

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

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

Hi,

 

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

 

Thanks

Prakash Pisipati

 

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

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report