"dwg" is short for "drawing", it is a file format saved by AutoCAD.
And "dxf" is data exchange format, which can be converted from a dwg file.
We cannot read dwg directly, and need to convert it to dxf first via ODA.
Supported dxf version: AutoCAD 2018. Both binary and ascii are supported.
Json Encoding: UTF-8 encoding without BOM
Coordinate system: right-handed, y-up
About units:
The unit of distance follows the master dxf file's unit
The unit of area follows the master dxf file's unit
The unit of angle is "degree", counterclockwise
The unit of time is "second"
Color: use rgb/rgba, values between 0-1
About Measurement in DxfViewer:
A measurement is generated by DxfViewer.
Measurements data should be stored by users, so users can restore measurements data into DxfViewer later.
DxfViewer manages measurements data, it can be created, removed, hidden, etc.
DxfViewer doesn't maintain the relationship between measurement and layout.
About Markup in DxfViewer:
Markup is pretty similar to measurement.
About Hotpoint in DxfViewer:
A hotpoint is created and stored by user.
A hotpoint can be added to, and removed from DxfViewer.
Caller should set a hotpointId that is unique in the session of current DxfViewer.
DxfViewer doesn't hide a hotpoint, user is able to do it.
DxfViewer doesn't maintain the relationship between hotpoint and layout.
About layouts
Each layout has its own home view.
When switching to another layout, it clears all measurements, markups and hotpoints.
When switching to another layout, it deactivates any in-progress operation like measurement, markup, etc.
About overlay
It supports to add as many models as user want, as long as the browser has sufficient memory, cpu/gpu, etc.
The first model is called "master" model, others are called "overlay" models.
It ignores an overlay model's paper space.
An overlay model's unit should be converted to master model's unit if they are not the same.
We'll append modelId as prefix for getLayers()
About comparision
It compares just "Model" spaces.
It compares entities with the same handles and types.
It compares entities' geometries, positions, scales, etc.
It ignores a layer's visibility, freeze settings.
It ignores an entity's properties, like linetype, line width, fill pattern, font, color, etc.
It ignores spatial filters (xclip) of block references.
It ignores layer relative operations, like moving an entity to another layer, changing a layer color, etc.
By default, an "Added" entity is rendered in green, a "Removed" entity is in red, a "Modified" entity is composed by two parts, one "Removed" and another "Added".
About undo/redo
It supports undo/redo for measurement and markup operations. E.g., creating/deleting/moving a markup.
Setting/removing a batch of measurements or markups will be taken as one operation.
Switching to another layout clears all undo/redo history.
About OSnap
It supports snapping to the end points and middle point of a line.
It supports snapping to the intersection point of two lines.
It supports snapping to the foot of perpendicular against a line.
{en} Loads a dxf file.
The first loaded file will be taken as a "master" model.
Any other files are non-master, we call "overlay" model.
We'll load everything of a master model, including model and paper space.
For an overlay model, we'll only load its model space. And its model space can only
overly to master model's model space.
{en} Blue channel value between 0 and 1.
-{zh} 蓝色通道值,介于 0 和 1 之间。
Returns void
setFont
setFont(urls: string[]): Promise<void>
description
{en} Sets font.
This needs to be called before loading a dxf, it won't affect any loaded text.
It accepts shx or typeface formats. For typeface, it only support passing in 1 font file in the array for now.
"dwg" is short for "drawing", it is a file format saved by AutoCAD. And "dxf" is data exchange format, which can be converted from a dwg file. We cannot read dwg directly, and need to convert it to dxf first via ODA.
Supported dxf version: AutoCAD 2018. Both binary and ascii are supported.
Json Encoding: UTF-8 encoding without BOM
Coordinate system: right-handed, y-up
About units:
Color: use rgb/rgba, values between 0-1
About Measurement in DxfViewer:
About Markup in DxfViewer: Markup is pretty similar to measurement.
About Hotpoint in DxfViewer:
About layouts
About overlay
About comparision
About undo/redo
About OSnap