Convert SVG file to Autodesk Viewer svf format - svg

We are looking at using the Forge Viewer for a project to display and markup plans, etc. (for now just 2D, 3D may be added in the future). For some of these items we will have DWG Files that we can convert using model derivative API so no problem there. However, the client also has quite a few existing drawings saved in svg format from their legacy system.
The question is if there is a good way to convert those base svg files into svf that we can display as the 'main' drawing/view in Forge Viewer. I have found things about creating a markup layer from an svg file, but that's not really what we want. We would be using markups to have the user draw on top of the plan with their own tools and place markers, etc. but the main drawing should be from the svg file that they have.
Forgive me if this is simple but I'm fairly new to the viewer and model derivative API so I'm not figuring out how to make this work.

There is no translation support for SVG, to generate an SVF model out of it.
You could either
a) use the SVG inside a format that we support (e.g. DWG - perhaps place the SVG in it using Design Automation API) and translate that to SVF
b) load a dummy model as shown here, and then add the SVG as e.g. markup

Related

How to draw custom shapes with draw2d?

I am using draw2d javascript library for drawing predefined shapes and custom shapes in it's canvas.
As I don't have any example made yet, I am trying to copy from it's documentation but doesn't seem to find a good way to research it as it contains a whole lot of it.
Here is the circle example.
http://www.draw2d.org/draw2d_touch/jsdoc_6/#!/api/draw2d.shape.basic.Circle
and here are some more documentation with examples.
http://www.draw2d.org/draw2d_touch/jsdoc_6/
I have premade shapes with html and css and I am trying to drag and drop and render them on canvas like these in this image. Also when dropped, they should have input and output ports too.
Is it possible to convert this html/css to draw2d shapes?
So here this is made possible via extending draw2d's SVGFigure and thus we have ability to provide custom svg to render it as a custom shape.
Below links were useful in this context.
http://www.draw2d.org/draw2d_touch/jsdoc/#!/guide/extending_svg_figure-section-live-example
https://github.com/freegroup/draw2d/tree/master/examples/shape_custom_svg
http://www.draw2d.org/draw2d_touch/jsdoc_6/#!/api/draw2d.SetFigure
https://github.com/freegroup/draw2d/tree/master/examples/shape_labeld
https://github.com/freegroup/draw2d/tree/master/examples/shape_custom_markdown

Cross-Platform Vector Format

Does there exist a data (file?) format representing a resizable vector graphic that can be exported to iOS CoreGraphics AND be rendered on a Linux server? I've been considering SVG with this library, but I need support for text and element constraints (i.e. pinning elements to edges).
I am not aware of a file format that provides the functionality that you are looking for out of the box.
But you may want to consider using SVG in combination with Paper.js. In Paper.js you can add custom data to any item (http://paperjs.org/reference/item/#data). Using Javascript you can then interpret the data and use it for applying your constraints prior to rendering.
Please note that while Paper.js is quite good for doing layout of elements (applying your constraints should be easy) and it has SVG import and export, but it does not support the full SVG spec (especially filters are missing).

how to display 3D bulidings with texture in Cesium?

I'm working on 3D web-GIS of an urban area. 3D buildings (with texture) were created in Arcgis and I'm looking for the best solution to display this 3D model on the web. I tried Cesium but I couldn't convert the KML file to CZML. What should I do to convert KML to CZML? Is there any other solution to display 3D buildins on the Web
You could use the gltf format, which basically is JSON.
A converter script can be found on the gltf github page. Also you can convert files online on the cesium webpage.
Cesium provides a function to load gltf files named "Model.fromGltf" as described in their documentation.
Three.js offers the possibility to render gltf as well. You can find an example on the gltf github page as well.

App / script for cleaning up SVG files?

I'm looking for an app or a script (web service) that can clean up SVG files, by that I mean removing possible copious data such as metadata. When creating the SVG file I've used standard settings in Adobe Illustrator. Upon export the paths look like this -
M 678.567,252.999 c-0.546-1.307-3.898-3.118-5.005-4.007c-1.596-1.276-1.42-3.375-3.09-4.381c-4.297-2.571-9.604-3.125-13.746-5.916
While I need them be cleaned up and reordered in way like this -
M 600.375,693.40625 598.75,695.03125 596.125,694.34375 594.57422,700.50391 592.25,700.16406 591.875,702.59375 593.875,705.53125 592.75,706.40625 593.9375,710.53125 592.75,710.65625 590.3125,712.90625 589,711.96875 587.1875,712.90625 586.8125,711.40625 584.125,710.53125 581.9375,711.03125
Fairly new to working with SVG. What I need these paths for is drawing up a map with Raphael JS and it seems only to take the paths in that particular way.
I tried Scour (http://www.codedread.com/scour/) but with no success unfortunately (the web service isn't working and there were problems running the procedure with Terminal).
To me it looks like Raphaël should support all of the path syntax in SVG 1.1.
Anyway, ReadySetRaphael.com is a site that provides conversion of a subset of SVG to Raphaël code.
Convert .ttf (or other format) to .svg: https://everythingfonts.com/ttf-to-svg .
Convert the svg. to icons separated icomoon.io/app/#/select,
-Import icons'
-Select the icons that you want export
-Click en 'Generate SVG, PNG, PDF'

Download Raphael canvas as a SVG or PDF

I am using Raphael to create a dynamic visualization. Is it possible to allow the image generated on the Canvas to be downloaded as a SVG/PDF or another image format?
There are pieces of information missing here, namely browser support, server-/client-side solution and whether costs are okay or not. So I'll try to give you an exhaustive answer.
For a client-side solution, you can use DocRaptor. Just feed the SVG tree to DocRaptor This works for the SVG-producing browsers (all since 2005 except for IE prior to version 9). Note that DocRaptor has a fee for converting documents into PDF. For a free server-side solution for converting an SVG tree to a PDF, I would suggest using wkhtmltopdf as proposed in this answer.
For IE6-8, which Raphaël produces VML for, you could create a PHP solution using the Vector Converter library. When the conversion from VML to SVG is finished, sent the SVG to DocRaptor (or wkhtmltopdf).
There is no free client-side VML/SVG -> PDF solution that works for VML or SVG. To build that would mean interpreting SVG and/or VML, creating a PDF from it using JavaScript (there are JS PDF library attempts), and sending it to the client using some Flash technique. I guess nobody has attempted to build that yet. I might.
pdfkit seems to be the way to go, with using browserify to make the node code run client side. There is a nice demo here
You can save as an image using canvg and canvas2image libraries
http://code.google.com/p/canvg/
http://www.nihilogic.dk/labs/canvas2image/

Resources