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: 

Question regarding SVG data from Revit

1 REPLY 1
SOLVED
Reply
Message 1 of 2
Anonymous
809 Views, 1 Reply

Question regarding SVG data from Revit

Hi all,

 

We've developed a plug-in for Revit which exports the rooms and geometry data from a model to a database. Some of Jeremy Tammik's blog posts offered great help in achieving this. Everything is working just fine. However, we’ve got a question regarding the generated SVG paths. Please check the following image of a room and its corresponding path:

 

svg.jpg

M 61.828 80.873 # m 61.828 80.873 # 1
L 61.828 82.735
L 70.866 82.735
L 70.866 82.677
L 82.062 82.677
L 82.062 80.873
L 82.062 60.902
L 82.062 58.686
L 61.828 58.686
L 61.828 60.296
A 7.218 15.483 0 0 1 67.738 70.036
A 7.218 7.314 0 0 1 67.911 70.578
A 7.215 7.215 0 0 1 65.278 78.395
A 7.218 7.314 0 0 1 61.828 79.762
L 61.828 80.873
Z

What do the coordinates actually represent? We don’t really know how to interpret them.

 

We would like to know how we can convert this path to millimeters based coordinates. As an addition, it would be great if we could convert the points relative to the site survey point.

 

Any help would be greatly appreciated!

1 REPLY 1
Message 2 of 2
jeremytammik
in reply to: Anonymous

Dear Bryan,

 

Thank you for raising this question here in the public forum after our preceding private email conversation, and congratulations on finally succeeding to post it!

 

I am glad that my previous work on this was useful to you.

 

What these coordinates mean is of course entirely dependent on how you generated them.

 

If they come straight from the Revit database, they are presumably still using the built-in Revit database length unit, which is imperial feet:

 

http://thebuildingcoder.typepad.com/blog/2011/03/internal-imperial-units.html

 

In my more recent work, I have always proceeded as follows before exporting any coordinate data from Revit:

 

  • Convert the internal units from feet to millimetres.
  • Round the millimetres to an integer value.

 

That makes the output file more readable for Europeans and all other non-imperial users, it saves lots of processing effort and space by working in integer values instead of doubles, and the output files are smaller, lacking the decimal separator and post-comma digits.

 

Is that the answer to your question, or do you mean something different?

 

If your question is more complex, you may have to post some code snippets demonstrating how this output is retrieved from the database, processed and generated.

 

Oh, reading the last two sentences clarifies things a lot more.

 

Here is a more recent effort showing how to convert to millimetres:

 

https://github.com/jeremytammik/ElementOutline

 

https://github.com/jeremytammik/ElementOutline/blob/master/ElementOutline/Util.cs#L127-L133

 

 

    public static int ConvertFeetToMillimetres(
      double d )
    {
      return (int) Math.Round( _feet_to_mm * d,
        MidpointRounding.AwayFromZero );
    }

 

 

https://github.com/jeremytammik/ElementOutline/blob/master/ElementOutline/Point2dInt.cs#L36-L45

 

    /// <summary>
    /// Convert a 3D Revit XYZ to a 2D millimetre 
    /// integer point by discarding the Z coordinate
    /// and scaling from feet to mm.
    /// </summary>
    public Point2dInt( XYZ p )
    {
      X = Util.ConvertFeetToMillimetres( p.X );
      Y = Util.ConvertFeetToMillimetres( p.Y );
    }

 

I hope this helps.

 

I am looking forward to hearing more about how you end up solving this and what you are doing with it. Thank you! 

  

Best regards,

 

Jeremy

 

 

 

 

 

 



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  

Rail Community


Autodesk Design & Make Report