var Sn = Object.defineProperty; var Nn = (n, t, e) => t in n ? Sn(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e; var N = (n, t, e) => Nn(n, typeof t != "symbol" ? t + "" : t, e); var It; (function(n) { n[n.CP_UTF8 = 0] = "CP_UTF8", n[n.CP_US_ASCII = 1] = "CP_US_ASCII", n[n.CP_ISO_8859_1 = 2] = "CP_ISO_8859_1", n[n.CP_ISO_8859_2 = 3] = "CP_ISO_8859_2", n[n.CP_ISO_8859_3 = 4] = "CP_ISO_8859_3", n[n.CP_ISO_8859_4 = 5] = "CP_ISO_8859_4", n[n.CP_ISO_8859_5 = 6] = "CP_ISO_8859_5", n[n.CP_ISO_8859_6 = 7] = "CP_ISO_8859_6", n[n.CP_ISO_8859_7 = 8] = "CP_ISO_8859_7", n[n.CP_ISO_8859_8 = 9] = "CP_ISO_8859_8", n[n.CP_ISO_8859_9 = 10] = "CP_ISO_8859_9", n[n.CP_CP437 = 11] = "CP_CP437", n[n.CP_CP850 = 12] = "CP_CP850", n[n.CP_CP852 = 13] = "CP_CP852", n[n.CP_CP855 = 14] = "CP_CP855", n[n.CP_CP857 = 15] = "CP_CP857", n[n.CP_CP860 = 16] = "CP_CP860", n[n.CP_CP861 = 17] = "CP_CP861", n[n.CP_CP863 = 18] = "CP_CP863", n[n.CP_CP864 = 19] = "CP_CP864", n[n.CP_CP865 = 20] = "CP_CP865", n[n.CP_CP869 = 21] = "CP_CP869", n[n.CP_CP932 = 22] = "CP_CP932", n[n.CP_MACINTOSH = 23] = "CP_MACINTOSH", n[n.CP_BIG5 = 24] = "CP_BIG5", n[n.CP_CP949 = 25] = "CP_CP949", n[n.CP_JOHAB = 26] = "CP_JOHAB", n[n.CP_CP866 = 27] = "CP_CP866", n[n.CP_ANSI_1250 = 28] = "CP_ANSI_1250", n[n.CP_ANSI_1251 = 29] = "CP_ANSI_1251", n[n.CP_ANSI_1252 = 30] = "CP_ANSI_1252", n[n.CP_GB2312 = 31] = "CP_GB2312", n[n.CP_ANSI_1253 = 32] = "CP_ANSI_1253", n[n.CP_ANSI_1254 = 33] = "CP_ANSI_1254", n[n.CP_ANSI_1255 = 34] = "CP_ANSI_1255", n[n.CP_ANSI_1256 = 35] = "CP_ANSI_1256", n[n.CP_ANSI_1257 = 36] = "CP_ANSI_1257", n[n.CP_ANSI_874 = 37] = "CP_ANSI_874", n[n.CP_ANSI_932 = 38] = "CP_ANSI_932", n[n.CP_ANSI_936 = 39] = "CP_ANSI_936", n[n.CP_ANSI_949 = 40] = "CP_ANSI_949", n[n.CP_ANSI_950 = 41] = "CP_ANSI_950", n[n.CP_ANSI_1361 = 42] = "CP_ANSI_1361", n[n.CP_UTF16 = 43] = "CP_UTF16", n[n.CP_ANSI_1258 = 44] = "CP_ANSI_1258", n[n.CP_UNDEFINED = 255] = "CP_UNDEFINED"; })(It || (It = {})); const Gn = [ "utf-8", // 0 "utf-8", // US ASCII "iso-8859-1", "iso-8859-2", "iso-8859-3", "iso-8859-4", "iso-8859-5", "iso-8859-6", "iso-8859-7", "iso-8859-8", "iso-8859-9", // 10 "utf-8", // DOS English "utf-8", // 12 DOS Latin-1 "utf-8", // DOS Central European "utf-8", // DOS Cyrillic "utf-8", // DOS Turkish "utf-8", // DOS Portoguese "utf-8", // DOS Icelandic "utf-8", // DOS Hebrew "utf-8", // DOS Arabic (IBM) "utf-8", // DOS Nordic "utf-8", // DOS Greek "shift-jis", // DOS Japanese (shiftjis) "macintosh", // 23 "big5", "utf-8", // Korean (Wansung + Johab) "utf-8", // Johab? "ibm866", // Russian "windows-1250", // Central + Eastern European "windows-1251", // Cyrillic "windows-1252", // Western European "gbk", // EUC-CN Chinese "windows-1253", // Greek "windows-1254", // Turkish "windows-1255", // Hebrew "windows-1256", // Arabic "windows-1257", // Baltic "windows-874", // Thai "shift-jis", // 38 Japanese (extended shiftjis, windows-31j) "gbk", // 39 Simplified Chinese "euc-kr", // 40 Korean Wansung "big5", // 41 Trad Chinese "utf-8", // 42 Korean Wansung "utf-16le", "windows-1258" // Vietnamese ], At = (n) => Gn[n]; var Pt; (function(n) { n[n.Rotated = 0] = "Rotated", n[n.Aligned = 1] = "Aligned", n[n.Angular = 2] = "Angular", n[n.Diameter = 3] = "Diameter", n[n.Radius = 4] = "Radius", n[n.Angular3Point = 5] = "Angular3Point", n[n.Ordinate = 6] = "Ordinate", n[n.ReferenceIsExclusive = 32] = "ReferenceIsExclusive", n[n.IsOrdinateXTypeFlag = 64] = "IsOrdinateXTypeFlag", n[n.IsCustomTextPositionFlag = 128] = "IsCustomTextPositionFlag"; })(Pt || (Pt = {})); var m; (function(n) { n[n.TopLeft = 1] = "TopLeft", n[n.TopCenter = 2] = "TopCenter", n[n.TopRight = 3] = "TopRight", n[n.MiddleLeft = 4] = "MiddleLeft", n[n.MiddleCenter = 5] = "MiddleCenter", n[n.MiddleRight = 6] = "MiddleRight", n[n.BottomLeft = 7] = "BottomLeft", n[n.BottomCenter = 8] = "BottomCenter", n[n.BottomRight = 9] = "BottomRight"; })(m || (m = {})); var Tt; (function(n) { n[n.AtLeast = 1] = "AtLeast", n[n.Exact = 2] = "Exact"; })(Tt || (Tt = {})); var Ct; (function(n) { n[n.Center = 0] = "Center", n[n.Above = 1] = "Above", n[n.Outside = 2] = "Outside", n[n.JIS = 3] = "JIS", n[n.Below = 4] = "Below"; })(Ct || (Ct = {})); var ht; (function(n) { n[n.Feet = 0] = "Feet", n[n.None = 1] = "None", n[n.Inch = 2] = "Inch", n[n.FeetAndInch = 3] = "FeetAndInch", n[n.Leading = 4] = "Leading", n[n.Trailing = 8] = "Trailing", n[n.LeadingAndTrailing = 12] = "LeadingAndTrailing"; })(ht || (ht = {})); var Yt; (function(n) { n[n.None = 0] = "None", n[n.Leading = 1] = "Leading", n[n.Trailing = 2] = "Trailing", n[n.LeadingAndTrailing = 3] = "LeadingAndTrailing"; })(Yt || (Yt = {})); var Rt; (function(n) { n[n.Center = 0] = "Center", n[n.Left = 1] = "Left", n[n.Right = 2] = "Right", n[n.OverFirst = 3] = "OverFirst", n[n.OverSecond = 4] = "OverSecond"; })(Rt || (Rt = {})); var ft; (function(n) { n[n.Bottom = 0] = "Bottom", n[n.Center = 1] = "Center", n[n.Top = 2] = "Top"; })(ft || (ft = {})); var z; (function(n) { n[n.PatternFill = 0] = "PatternFill", n[n.SolidFill = 1] = "SolidFill"; })(z || (z = {})); var Z; (function(n) { n[n.NonAssociative = 0] = "NonAssociative", n[n.Associative = 1] = "Associative"; })(Z || (Z = {})); var vt; (function(n) { n[n.Normal = 0] = "Normal", n[n.Outer = 1] = "Outer", n[n.Ignore = 2] = "Ignore"; })(vt || (vt = {})); var Lt; (function(n) { n[n.UserDefined = 0] = "UserDefined", n[n.Predefined = 1] = "Predefined", n[n.Custom = 2] = "Custom"; })(Lt || (Lt = {})); var St; (function(n) { n[n.NotAnnotated = 0] = "NotAnnotated", n[n.Annotated = 1] = "Annotated"; })(St || (St = {})); var Et; (function(n) { n[n.Solid = 0] = "Solid", n[n.Gradient = 1] = "Gradient"; })(Et || (Et = {})); var q; (function(n) { n[n.TwoColor = 0] = "TwoColor", n[n.OneColor = 1] = "OneColor"; })(q || (q = {})); var Nt; (function(n) { n[n.Default = 0] = "Default", n[n.External = 1] = "External", n[n.Polyline = 2] = "Polyline", n[n.Derived = 4] = "Derived", n[n.Textbox = 8] = "Textbox", n[n.Outermost = 16] = "Outermost"; })(Nt || (Nt = {})); var F; (function(n) { n[n.Line = 1] = "Line", n[n.Circular = 2] = "Circular", n[n.Elliptic = 3] = "Elliptic", n[n.Spline = 4] = "Spline"; })(F || (F = {})); var Gt; (function(n) { n[n.CLOSED_POLYLINE = 1] = "CLOSED_POLYLINE", n[n.CURVE_FIT = 2] = "CURVE_FIT", n[n.SPLINE_FIT = 4] = "SPLINE_FIT", n[n.POLYLINE_3D = 8] = "POLYLINE_3D", n[n.POLYGON_3D = 16] = "POLYGON_3D", n[n.CLOSED_POLYGON = 32] = "CLOSED_POLYGON", n[n.POLYFACE = 64] = "POLYFACE", n[n.CONTINUOUS = 128] = "CONTINUOUS"; })(Gt || (Gt = {})); var Dt; (function(n) { n[n.NONE = 0] = "NONE", n[n.QUADRATIC = 5] = "QUADRATIC", n[n.CUBIC = 6] = "CUBIC", n[n.BEZIER = 8] = "BEZIER"; })(Dt || (Dt = {})); var Wt; (function(n) { n[n.NONE = 0] = "NONE", n[n.MIRRORED_X = 2] = "MIRRORED_X", n[n.MIRRORED_Y = 4] = "MIRRORED_Y"; })(Wt || (Wt = {})); var Q; (function(n) { n[n.LEFT = 0] = "LEFT", n[n.CENTER = 1] = "CENTER", n[n.RIGHT = 2] = "RIGHT", n[n.ALIGNED = 3] = "ALIGNED", n[n.MIDDLE = 4] = "MIDDLE", n[n.FIT = 5] = "FIT"; })(Q || (Q = {})); var Mt; (function(n) { n[n.BASELINE = 0] = "BASELINE", n[n.BOTTOM = 1] = "BOTTOM", n[n.MIDDLE = 2] = "MIDDLE", n[n.TOP = 3] = "TOP"; })(Mt || (Mt = {})); const Dn = Object.freeze([ "ACADMAINTVER", "ACADVER", "ANGBASE", "ANGDIR", "ATTMODE", "AUNITS", "AUPREC", "CECOLOR", "CELTSCALE", "CELTYPE", "CELWEIGHT", "CEPSNID", "CEPSNTYPE", "CHAMFERA", "CHAMFERB", "CHAMFERC", "CHAMFERD", "CLAYER", "CMLJUST", "CMLSCALE", "CMLSTYLE", "CSHADOW", "DIMADEC", "DIMALT", "DIMALTD", "DIMALTF", "DIMALTRND", "DIMALTTD", "DIMALTTZ", "DIMALTU", "DIMALTZ", "DIMAPOST", "DIMASO", "DIMASSOC", "DIMASZ", "DIMATFIT", "DIMAUNIT", "DIMAZIN", "DIMBLK", "DIMBLK1", "DIMBLK2", "DIMCEN", "DIMCLRD", "DIMCLRE", "DIMCLRT", "DIMDEC", "DIMDLE", "DIMDLI", "DIMDSEP", "DIMEXE", "DIMEXO", "DIMFAC", "DIMGAP", "DIMJUST", "DIMLDRBLK", "DIMLFAC", "DIMLIM", "DIMLUNIT", "DIMLWD", "DIMLWE", "DIMPOST", "DIMRND", "DIMSAH", "DIMSCALE", "DIMSD1", "DIMSD2", "DIMSE1", "DIMSE2", "DIMSHO", "DIMSOXD", "DIMSTYLE", "DIMTAD", "DIMTDEC", "DIMTFAC", "DIMTIH", "DIMTIX", "DIMTM", "DIMTMOVE", "DIMTOFL", "DIMTOH", "DIMTOL", "DIMTOLJ", "DIMTP", "DIMTSZ", "DIMTVP", "DIMTXSTY", "DIMTXT", "DIMTZIN", "DIMUPT", "DIMZIN", "DISPSILH", "DRAGVS", "DWGCODEPAGE", "ELEVATION", "ENDCAPS", "EXTMAX", "EXTMIN", "EXTNAMES", "FILLETRAD", "FILLMODE", "FINGERPRINTGUID", "HALOGAP", "HANDSEED", "HIDETEXT", "HYPERLINKBASE", "INDEXCTL", "INSBASE", "INSUNITS", "INTERFERECOLOR", "INTERFEREOBJVS", "INTERFEREVPVS", "INTERSECTIONCOLOR", "INTERSECTIONDISPLAY", "JOINSTYLE", "LIMCHECK", "LIMMAX", "LIMMIN", "LTSCALE", "LUNITS", "LUPREC", "LWDISPLAY", "MAXACTVP", "MEASUREMENT", "MENU", "MIRRTEXT", "OBSCOLOR", "OBSLTYPE", "ORTHOMODE", "PDMODE", "PDSIZE", "PELEVATION", "PEXTMAX", "PEXTMIN", "PINSBASE", "PLIMCHECK", "PLIMMAX", "PLIMMIN", "PLINEGEN", "PLINEWID", "PROJECTNAME", "PROXYGRAPHICS", "PSLTSCALE", "PSTYLEMODE", "PSVPSCALE", "PUCSBASE", "PUCSNAME", "PUCSORG", "PUCSORGBACK", "PUCSORGBOTTOM", "PUCSORGFRONT", "PUCSORGLEFT", "PUCSORGRIGHT", "PUCSORGTOP", "PUCSORTHOREF", "PUCSORTHOVIEW", "PUCSXDIR", "PUCSYDIR", "QTEXTMODE", "REGENMODE", "SHADEDGE", "SHADEDIF", "SHADOWPLANELOCATION", "SKETCHINC", "SKPOLY", "SORTENTS", "SPLINESEGS", "SPLINETYPE", "SURFTAB1", "SURFTAB2", "SURFTYPE", "SURFU", "SURFV", "TDCREATE", "TDINDWG", "TDUCREATE", "TDUPDATE", "TDUSRTIMER", "TDUUPDATE", "TEXTSIZE", "TEXTSTYLE", "THICKNESS", "TILEMODE", "TRACEWID", "TREEDEPTH", "UCSBASE", "UCSNAME", "UCSORG", "UCSORGBACK", "UCSORGBOTTOM", "UCSORGFRONT", "UCSORGLEFT", "UCSORGRIGHT", "UCSORGTOP", "UCSORTHOREF", "UCSORTHOVIEW", "UCSXDIR", "UCSYDIR", "UNITMODE", "USERI1", "USERI2", "USERI3", "USERI4", "USERI5", "USERR1", "USERR2", "USERR3", "USERR4", "USERR5", "USRTIMER", "VERSIONGUID", "VISRETAIN", "WORLDVIEW", "XCLIPFRAME", "XEDIT" ]); var gt; (function(n) { n[n.NotApplicable = 0] = "NotApplicable", n[n.KeepExisting = 1] = "KeepExisting", n[n.UseClone = 2] = "UseClone", n[n.XrefName = 3] = "XrefName", n[n.Name = 4] = "Name", n[n.UnmangleName = 5] = "UnmangleName"; })(gt || (gt = {})); const Wn = [ { type: "invalid", hdr: "INVALI", description: "No DWG", version: 0 }, { type: "r1.1", hdr: "MC0.0", description: "MicroCAD Release 1.1", version: 0 }, { type: "r1.2", hdr: "AC1.2", description: "AutoCAD Release 1.2", version: 0 }, { type: "r1.3", hdr: "AC1.3", description: "AutoCAD Release 1.3", version: 1 }, { type: "r1.4", hdr: "AC1.40", description: "AutoCAD Release 1.4", version: 2 }, { type: "r2.0b", hdr: "AC1.50", description: "AutoCAD 2.0 beta", version: 3 }, // not seen { type: "r2.0", hdr: "AC1.50", description: "AutoCAD Release 2.0", version: 4 }, { type: "r2.10", hdr: "AC2.10", description: "AutoCAD Release 2.10", version: 5 }, { type: "r2.21", hdr: "AC2.21", description: "AutoCAD Release 2.21", version: 6 }, { type: "r2.22", hdr: "AC2.22", description: "AutoCAD Release 2.22", version: 7 }, { type: "r2.4", hdr: "AC1001", description: "AutoCAD Release 2.4", version: 8 }, { type: "r2.5", hdr: "AC1002", description: "AutoCAD Release 2.5", version: 9 }, { type: "r2.6", hdr: "AC1003", description: "AutoCAD Release 2.6", version: 10 }, { type: "r9", hdr: "AC1004", description: "AutoCAD Release 9", version: 11 }, { type: "r9c1", hdr: "AC1005", description: "AutoCAD Release 9c1", version: 12 }, { type: "r10", hdr: "AC1006", description: "AutoCAD Release 10", version: 13 }, { type: "r11b1", hdr: "AC1007", description: "AutoCAD 11 beta 1", version: 14 }, { type: "r11b2", hdr: "AC1008", description: "AutoCAD 11 beta 2", version: 15 }, { type: "r11", hdr: "AC1009", description: "AutoCAD Release 11/12 (LT R1/R2)", version: 16 }, { type: "r13b1", hdr: "AC1010", description: "AutoCAD pre-R13 a", version: 17 }, { type: "r13b2", hdr: "AC1011", description: "AutoCAD pre-R13 b", version: 18 }, { type: "r13", hdr: "AC1012", description: "AutoCAD Release 13", version: 19 }, { type: "r13c3", hdr: "AC1013", description: "AutoCAD Release 13c3", version: 20 }, { type: "r14", hdr: "AC1014", description: "AutoCAD Release 14", version: 21 }, { type: "r2000b", hdr: "AC1500", description: "AutoCAD 2000 beta", version: 22 }, { type: "r2000", hdr: "AC1015", description: "AutoCAD Release 2000", version: 23 }, { type: "r2000i", hdr: "AC1016", description: "AutoCAD Release 2000i", version: 23 }, { type: "r2002", hdr: "AC1017", description: "AutoCAD Release 2002", version: 23 }, { type: "r2004a", hdr: "AC402a", description: "AutoCAD 2004 alpha a", version: 24 }, { type: "r2004b", hdr: "AC402b", description: "AutoCAD 2004 alpha b", version: 24 }, { type: "r2004c", hdr: "AC1018", description: "AutoCAD 2004 beta", version: 24 }, // (includes versions AC1019/0x19 and AC1020/0x1a) { type: "r2004", hdr: "AC1018", description: "AutoCAD Release 2004", version: 25 }, //{ type: "r2005", hdr: "AC1019", description: "AutoCAD 2005", version: 0x19 }, // not seen //{ type: "r2006", hdr: "AC1020", description: "AutoCAD 2006", version: 0x19 }, // not seen { type: "r2007a", hdr: "AC701a", description: "AutoCAD 2007 alpha", version: 26 }, { type: "r2007b", hdr: "AC1021", description: "AutoCAD 2007 beta", version: 26 }, { type: "r2007", hdr: "AC1021", description: "AutoCAD Release 2007", version: 27 }, //{ type: "r2008", hdr: "AC1022", description: "AutoCAD 2008", version: 0x1b }, // not seen //{ type: "r2009", hdr: "AC1023", description: "AutoCAD 2009", version: 0x1b }, // not seen { type: "r2010b", hdr: "AC1024", description: "AutoCAD 2010 beta", version: 28 }, { type: "r2010", hdr: "AC1024", description: "AutoCAD Release 2010", version: 29 }, //{ type: "r2011", hdr: "AC1025", description: "AutoCAD 2011", version: 0x1d }, // not seen //{ type: "r2012", hdr: "AC1026", description: "AutoCAD 2012", version: 0x1e }, // not seen { type: "r2013b", hdr: "AC1027", description: "AutoCAD 2013 beta", version: 30 }, { type: "r2013", hdr: "AC1027", description: "AutoCAD Release 2013", version: 31 }, //{ type: "r2014", hdr: "AC1028", description: "AutoCAD 2014", version: 0x1f }, // not seen //{ type: "r2015", hdr: "AC1029", description: "AutoCAD 2015", version: 0x1f }, // not seen //{ type: "r2016", hdr: "AC1030", description: "AutoCAD 2016", version: 0x1f }, // not seen //{ type: "r2017", hdr: "AC1031", description: "AutoCAD 2017", version: 0x20 }, // not seen { type: "r2018b", hdr: "AC1032", description: "AutoCAD 2018 beta", version: 32 }, { type: "r2018", hdr: "AC1032", description: "AutoCAD Release 2018", version: 33 }, //{ type: "r2019", "AC1033", description: "AutoCAD Release 2019", version: 0x22 }, // not seen //{ type: "r2020", "AC1034", description: "AutoCAD Release 2020", version: 0x23 }, // not seen //{ type: "r2021", "AC1035", description: "AutoCAD Release 2021", version: 0x23 }, // not seen { type: "r2022b", hdr: "AC103-4", description: "AutoCAD 2022 beta", version: 36 }, { type: "r>2022", hdr: "", description: "AutoCAD Release >2022", version: 0 } ]; async function yt(n = {}) { const t = Mn(n), e = await import( /* @vite-ignore */ t ), a = e.default ?? e.createModule ?? e; if (typeof a != "function") throw new Error(`LibreDWG runtime module at ${t} did not export a createModule function.`); return a(n); } function Mn(n) { const t = n.locateFile; if (typeof t == "function") try { const e = t("libredwg-web.js", ""); if (typeof e == "string" && e.length > 0) return e; } catch { } return typeof document < "u" && document.baseURI ? new URL("wasm/libredwg-web.js", document.baseURI).href : typeof location < "u" && location.href ? new URL("/wasm/libredwg-web.js", location.origin).href : "/wasm/libredwg-web.js"; } var xt; (function(n) { n[n.DWG_SUPERTYPE_ENTITY = 0] = "DWG_SUPERTYPE_ENTITY", n[n.DWG_SUPERTYPE_OBJECT = 1] = "DWG_SUPERTYPE_OBJECT"; })(xt || (xt = {})); var P; (function(n) { n[n.DWG_TYPE_UNUSED = 0] = "DWG_TYPE_UNUSED", n[n.DWG_TYPE_TEXT = 1] = "DWG_TYPE_TEXT", n[n.DWG_TYPE_ATTRIB = 2] = "DWG_TYPE_ATTRIB", n[n.DWG_TYPE_ATTDEF = 3] = "DWG_TYPE_ATTDEF", n[n.DWG_TYPE_BLOCK = 4] = "DWG_TYPE_BLOCK", n[n.DWG_TYPE_ENDBLK = 5] = "DWG_TYPE_ENDBLK", n[n.DWG_TYPE_SEQEND = 6] = "DWG_TYPE_SEQEND", n[n.DWG_TYPE_INSERT = 7] = "DWG_TYPE_INSERT", n[n.DWG_TYPE_MINSERT = 8] = "DWG_TYPE_MINSERT", n[n.DWG_TYPE_VERTEX_2D = 10] = "DWG_TYPE_VERTEX_2D", n[n.DWG_TYPE_VERTEX_3D = 11] = "DWG_TYPE_VERTEX_3D", n[n.DWG_TYPE_VERTEX_MESH = 12] = "DWG_TYPE_VERTEX_MESH", n[n.DWG_TYPE_VERTEX_PFACE = 13] = "DWG_TYPE_VERTEX_PFACE", n[n.DWG_TYPE_VERTEX_PFACE_FACE = 14] = "DWG_TYPE_VERTEX_PFACE_FACE", n[n.DWG_TYPE_POLYLINE_2D = 15] = "DWG_TYPE_POLYLINE_2D", n[n.DWG_TYPE_POLYLINE_3D = 16] = "DWG_TYPE_POLYLINE_3D", n[n.DWG_TYPE_ARC = 17] = "DWG_TYPE_ARC", n[n.DWG_TYPE_CIRCLE = 18] = "DWG_TYPE_CIRCLE", n[n.DWG_TYPE_LINE = 19] = "DWG_TYPE_LINE", n[n.DWG_TYPE_DIMENSION_ORDINATE = 20] = "DWG_TYPE_DIMENSION_ORDINATE", n[n.DWG_TYPE_DIMENSION_LINEAR = 21] = "DWG_TYPE_DIMENSION_LINEAR", n[n.DWG_TYPE_DIMENSION_ALIGNED = 22] = "DWG_TYPE_DIMENSION_ALIGNED", n[n.DWG_TYPE_DIMENSION_ANG3PT = 23] = "DWG_TYPE_DIMENSION_ANG3PT", n[n.DWG_TYPE_DIMENSION_ANG2LN = 24] = "DWG_TYPE_DIMENSION_ANG2LN", n[n.DWG_TYPE_DIMENSION_RADIUS = 25] = "DWG_TYPE_DIMENSION_RADIUS", n[n.DWG_TYPE_DIMENSION_DIAMETER = 26] = "DWG_TYPE_DIMENSION_DIAMETER", n[n.DWG_TYPE_POINT = 27] = "DWG_TYPE_POINT", n[n.DWG_TYPE_3DFACE = 28] = "DWG_TYPE_3DFACE", n[n.DWG_TYPE_POLYLINE_PFACE = 29] = "DWG_TYPE_POLYLINE_PFACE", n[n.DWG_TYPE_POLYLINE_MESH = 30] = "DWG_TYPE_POLYLINE_MESH", n[n.DWG_TYPE_SOLID = 31] = "DWG_TYPE_SOLID", n[n.DWG_TYPE_TRACE = 32] = "DWG_TYPE_TRACE", n[n.DWG_TYPE_SHAPE = 33] = "DWG_TYPE_SHAPE", n[n.DWG_TYPE_VIEWPORT = 34] = "DWG_TYPE_VIEWPORT", n[n.DWG_TYPE_ELLIPSE = 35] = "DWG_TYPE_ELLIPSE", n[n.DWG_TYPE_SPLINE = 36] = "DWG_TYPE_SPLINE", n[n.DWG_TYPE_REGION = 37] = "DWG_TYPE_REGION", n[n.DWG_TYPE_3DSOLID = 38] = "DWG_TYPE_3DSOLID", n[n.DWG_TYPE_BODY = 39] = "DWG_TYPE_BODY", n[n.DWG_TYPE_RAY = 40] = "DWG_TYPE_RAY", n[n.DWG_TYPE_XLINE = 41] = "DWG_TYPE_XLINE", n[n.DWG_TYPE_DICTIONARY = 42] = "DWG_TYPE_DICTIONARY", n[n.DWG_TYPE_OLEFRAME = 43] = "DWG_TYPE_OLEFRAME", n[n.DWG_TYPE_MTEXT = 44] = "DWG_TYPE_MTEXT", n[n.DWG_TYPE_LEADER = 45] = "DWG_TYPE_LEADER", n[n.DWG_TYPE_TOLERANCE = 46] = "DWG_TYPE_TOLERANCE", n[n.DWG_TYPE_MLINE = 47] = "DWG_TYPE_MLINE", n[n.DWG_TYPE_BLOCK_CONTROL = 48] = "DWG_TYPE_BLOCK_CONTROL", n[n.DWG_TYPE_BLOCK_HEADER = 49] = "DWG_TYPE_BLOCK_HEADER", n[n.DWG_TYPE_LAYER_CONTROL = 50] = "DWG_TYPE_LAYER_CONTROL", n[n.DWG_TYPE_LAYER = 51] = "DWG_TYPE_LAYER", n[n.DWG_TYPE_STYLE_CONTROL = 52] = "DWG_TYPE_STYLE_CONTROL", n[n.DWG_TYPE_STYLE = 53] = "DWG_TYPE_STYLE", n[n.DWG_TYPE_LTYPE_CONTROL = 56] = "DWG_TYPE_LTYPE_CONTROL", n[n.DWG_TYPE_LTYPE = 57] = "DWG_TYPE_LTYPE", n[n.DWG_TYPE_VIEW_CONTROL = 60] = "DWG_TYPE_VIEW_CONTROL", n[n.DWG_TYPE_VIEW = 61] = "DWG_TYPE_VIEW", n[n.DWG_TYPE_UCS_CONTROL = 62] = "DWG_TYPE_UCS_CONTROL", n[n.DWG_TYPE_UCS = 63] = "DWG_TYPE_UCS", n[n.DWG_TYPE_VPORT_CONTROL = 64] = "DWG_TYPE_VPORT_CONTROL", n[n.DWG_TYPE_VPORT = 65] = "DWG_TYPE_VPORT", n[n.DWG_TYPE_APPID_CONTROL = 66] = "DWG_TYPE_APPID_CONTROL", n[n.DWG_TYPE_APPID = 67] = "DWG_TYPE_APPID", n[n.DWG_TYPE_DIMSTYLE_CONTROL = 68] = "DWG_TYPE_DIMSTYLE_CONTROL", n[n.DWG_TYPE_DIMSTYLE = 69] = "DWG_TYPE_DIMSTYLE", n[n.DWG_TYPE_VX_CONTROL = 70] = "DWG_TYPE_VX_CONTROL", n[n.DWG_TYPE_VX_TABLE_RECORD = 71] = "DWG_TYPE_VX_TABLE_RECORD", n[n.DWG_TYPE_GROUP = 72] = "DWG_TYPE_GROUP", n[n.DWG_TYPE_MLINESTYLE = 73] = "DWG_TYPE_MLINESTYLE", n[n.DWG_TYPE_OLE2FRAME = 74] = "DWG_TYPE_OLE2FRAME", n[n.DWG_TYPE_DUMMY = 75] = "DWG_TYPE_DUMMY", n[n.DWG_TYPE_LONG_TRANSACTION = 76] = "DWG_TYPE_LONG_TRANSACTION", n[n.DWG_TYPE_LWPOLYLINE = 77] = "DWG_TYPE_LWPOLYLINE", n[n.DWG_TYPE_HATCH = 78] = "DWG_TYPE_HATCH", n[n.DWG_TYPE_XRECORD = 79] = "DWG_TYPE_XRECORD", n[n.DWG_TYPE_PLACEHOLDER = 80] = "DWG_TYPE_PLACEHOLDER", n[n.DWG_TYPE_VBA_PROJECT = 81] = "DWG_TYPE_VBA_PROJECT", n[n.DWG_TYPE_LAYOUT = 82] = "DWG_TYPE_LAYOUT", n[n.DWG_TYPE_PROXY_ENTITY = 498] = "DWG_TYPE_PROXY_ENTITY", n[n.DWG_TYPE_PROXY_OBJECT = 499] = "DWG_TYPE_PROXY_OBJECT", n[n.DWG_TYPE_ACDSRECORD = 500] = "DWG_TYPE_ACDSRECORD", n[n.DWG_TYPE_ACDSSCHEMA = 501] = "DWG_TYPE_ACDSSCHEMA", n[n.DWG_TYPE_ACMECOMMANDHISTORY = 502] = "DWG_TYPE_ACMECOMMANDHISTORY", n[n.DWG_TYPE_ACMESCOPE = 503] = "DWG_TYPE_ACMESCOPE", n[n.DWG_TYPE_ACMESTATEMGR = 504] = "DWG_TYPE_ACMESTATEMGR", n[n.DWG_TYPE_ACSH_BOOLEAN_CLASS = 505] = "DWG_TYPE_ACSH_BOOLEAN_CLASS", n[n.DWG_TYPE_ACSH_BOX_CLASS = 506] = "DWG_TYPE_ACSH_BOX_CLASS", n[n.DWG_TYPE_ACSH_BREP_CLASS = 507] = "DWG_TYPE_ACSH_BREP_CLASS", n[n.DWG_TYPE_ACSH_CHAMFER_CLASS = 508] = "DWG_TYPE_ACSH_CHAMFER_CLASS", n[n.DWG_TYPE_ACSH_CONE_CLASS = 509] = "DWG_TYPE_ACSH_CONE_CLASS", n[n.DWG_TYPE_ACSH_CYLINDER_CLASS = 510] = "DWG_TYPE_ACSH_CYLINDER_CLASS", n[n.DWG_TYPE_ACSH_EXTRUSION_CLASS = 511] = "DWG_TYPE_ACSH_EXTRUSION_CLASS", n[n.DWG_TYPE_ACSH_FILLET_CLASS = 512] = "DWG_TYPE_ACSH_FILLET_CLASS", n[n.DWG_TYPE_ACSH_HISTORY_CLASS = 513] = "DWG_TYPE_ACSH_HISTORY_CLASS", n[n.DWG_TYPE_ACSH_LOFT_CLASS = 514] = "DWG_TYPE_ACSH_LOFT_CLASS", n[n.DWG_TYPE_ACSH_PYRAMID_CLASS = 515] = "DWG_TYPE_ACSH_PYRAMID_CLASS", n[n.DWG_TYPE_ACSH_REVOLVE_CLASS = 516] = "DWG_TYPE_ACSH_REVOLVE_CLASS", n[n.DWG_TYPE_ACSH_SPHERE_CLASS = 517] = "DWG_TYPE_ACSH_SPHERE_CLASS", n[n.DWG_TYPE_ACSH_SWEEP_CLASS = 518] = "DWG_TYPE_ACSH_SWEEP_CLASS", n[n.DWG_TYPE_ACSH_TORUS_CLASS = 519] = "DWG_TYPE_ACSH_TORUS_CLASS", n[n.DWG_TYPE_ACSH_WEDGE_CLASS = 520] = "DWG_TYPE_ACSH_WEDGE_CLASS", n[n.DWG_TYPE_ALDIMOBJECTCONTEXTDATA = 521] = "DWG_TYPE_ALDIMOBJECTCONTEXTDATA", n[n.DWG_TYPE_ALIGNMENTPARAMETERENTITY = 522] = "DWG_TYPE_ALIGNMENTPARAMETERENTITY", n[n.DWG_TYPE_ANGDIMOBJECTCONTEXTDATA = 523] = "DWG_TYPE_ANGDIMOBJECTCONTEXTDATA", n[n.DWG_TYPE_ANNOTSCALEOBJECTCONTEXTDATA = 524] = "DWG_TYPE_ANNOTSCALEOBJECTCONTEXTDATA", n[n.DWG_TYPE_ARCALIGNEDTEXT = 525] = "DWG_TYPE_ARCALIGNEDTEXT", n[n.DWG_TYPE_ARC_DIMENSION = 526] = "DWG_TYPE_ARC_DIMENSION", n[n.DWG_TYPE_ASSOC2DCONSTRAINTGROUP = 527] = "DWG_TYPE_ASSOC2DCONSTRAINTGROUP", n[n.DWG_TYPE_ASSOC3POINTANGULARDIMACTIONBODY = 528] = "DWG_TYPE_ASSOC3POINTANGULARDIMACTIONBODY", n[n.DWG_TYPE_ASSOCACTION = 529] = "DWG_TYPE_ASSOCACTION", n[n.DWG_TYPE_ASSOCACTIONPARAM = 530] = "DWG_TYPE_ASSOCACTIONPARAM", n[n.DWG_TYPE_ASSOCALIGNEDDIMACTIONBODY = 531] = "DWG_TYPE_ASSOCALIGNEDDIMACTIONBODY", n[n.DWG_TYPE_ASSOCARRAYACTIONBODY = 532] = "DWG_TYPE_ASSOCARRAYACTIONBODY", n[n.DWG_TYPE_ASSOCARRAYMODIFYACTIONBODY = 533] = "DWG_TYPE_ASSOCARRAYMODIFYACTIONBODY", n[n.DWG_TYPE_ASSOCARRAYMODIFYPARAMETERS = 534] = "DWG_TYPE_ASSOCARRAYMODIFYPARAMETERS", n[n.DWG_TYPE_ASSOCARRAYPATHPARAMETERS = 535] = "DWG_TYPE_ASSOCARRAYPATHPARAMETERS", n[n.DWG_TYPE_ASSOCARRAYPOLARPARAMETERS = 536] = "DWG_TYPE_ASSOCARRAYPOLARPARAMETERS", n[n.DWG_TYPE_ASSOCARRAYRECTANGULARPARAMETERS = 537] = "DWG_TYPE_ASSOCARRAYRECTANGULARPARAMETERS", n[n.DWG_TYPE_ASSOCASMBODYACTIONPARAM = 538] = "DWG_TYPE_ASSOCASMBODYACTIONPARAM", n[n.DWG_TYPE_ASSOCBLENDSURFACEACTIONBODY = 539] = "DWG_TYPE_ASSOCBLENDSURFACEACTIONBODY", n[n.DWG_TYPE_ASSOCCOMPOUNDACTIONPARAM = 540] = "DWG_TYPE_ASSOCCOMPOUNDACTIONPARAM", n[n.DWG_TYPE_ASSOCDEPENDENCY = 541] = "DWG_TYPE_ASSOCDEPENDENCY", n[n.DWG_TYPE_ASSOCDIMDEPENDENCYBODY = 542] = "DWG_TYPE_ASSOCDIMDEPENDENCYBODY", n[n.DWG_TYPE_ASSOCEDGEACTIONPARAM = 543] = "DWG_TYPE_ASSOCEDGEACTIONPARAM", n[n.DWG_TYPE_ASSOCEDGECHAMFERACTIONBODY = 544] = "DWG_TYPE_ASSOCEDGECHAMFERACTIONBODY", n[n.DWG_TYPE_ASSOCEDGEFILLETACTIONBODY = 545] = "DWG_TYPE_ASSOCEDGEFILLETACTIONBODY", n[n.DWG_TYPE_ASSOCEXTENDSURFACEACTIONBODY = 546] = "DWG_TYPE_ASSOCEXTENDSURFACEACTIONBODY", n[n.DWG_TYPE_ASSOCEXTRUDEDSURFACEACTIONBODY = 547] = "DWG_TYPE_ASSOCEXTRUDEDSURFACEACTIONBODY", n[n.DWG_TYPE_ASSOCFACEACTIONPARAM = 548] = "DWG_TYPE_ASSOCFACEACTIONPARAM", n[n.DWG_TYPE_ASSOCFILLETSURFACEACTIONBODY = 549] = "DWG_TYPE_ASSOCFILLETSURFACEACTIONBODY", n[n.DWG_TYPE_ASSOCGEOMDEPENDENCY = 550] = "DWG_TYPE_ASSOCGEOMDEPENDENCY", n[n.DWG_TYPE_ASSOCLOFTEDSURFACEACTIONBODY = 551] = "DWG_TYPE_ASSOCLOFTEDSURFACEACTIONBODY", n[n.DWG_TYPE_ASSOCMLEADERACTIONBODY = 552] = "DWG_TYPE_ASSOCMLEADERACTIONBODY", n[n.DWG_TYPE_ASSOCNETWORK = 553] = "DWG_TYPE_ASSOCNETWORK", n[n.DWG_TYPE_ASSOCNETWORKSURFACEACTIONBODY = 554] = "DWG_TYPE_ASSOCNETWORKSURFACEACTIONBODY", n[n.DWG_TYPE_ASSOCOBJECTACTIONPARAM = 555] = "DWG_TYPE_ASSOCOBJECTACTIONPARAM", n[n.DWG_TYPE_ASSOCOFFSETSURFACEACTIONBODY = 556] = "DWG_TYPE_ASSOCOFFSETSURFACEACTIONBODY", n[n.DWG_TYPE_ASSOCORDINATEDIMACTIONBODY = 557] = "DWG_TYPE_ASSOCORDINATEDIMACTIONBODY", n[n.DWG_TYPE_ASSOCOSNAPPOINTREFACTIONPARAM = 558] = "DWG_TYPE_ASSOCOSNAPPOINTREFACTIONPARAM", n[n.DWG_TYPE_ASSOCPATCHSURFACEACTIONBODY = 559] = "DWG_TYPE_ASSOCPATCHSURFACEACTIONBODY", n[n.DWG_TYPE_ASSOCPATHACTIONPARAM = 560] = "DWG_TYPE_ASSOCPATHACTIONPARAM", n[n.DWG_TYPE_ASSOCPERSSUBENTMANAGER = 561] = "DWG_TYPE_ASSOCPERSSUBENTMANAGER", n[n.DWG_TYPE_ASSOCPLANESURFACEACTIONBODY = 562] = "DWG_TYPE_ASSOCPLANESURFACEACTIONBODY", n[n.DWG_TYPE_ASSOCPOINTREFACTIONPARAM = 563] = "DWG_TYPE_ASSOCPOINTREFACTIONPARAM", n[n.DWG_TYPE_ASSOCRESTOREENTITYSTATEACTIONBODY = 564] = "DWG_TYPE_ASSOCRESTOREENTITYSTATEACTIONBODY", n[n.DWG_TYPE_ASSOCREVOLVEDSURFACEACTIONBODY = 565] = "DWG_TYPE_ASSOCREVOLVEDSURFACEACTIONBODY", n[n.DWG_TYPE_ASSOCROTATEDDIMACTIONBODY = 566] = "DWG_TYPE_ASSOCROTATEDDIMACTIONBODY", n[n.DWG_TYPE_ASSOCSWEPTSURFACEACTIONBODY = 567] = "DWG_TYPE_ASSOCSWEPTSURFACEACTIONBODY", n[n.DWG_TYPE_ASSOCTRIMSURFACEACTIONBODY = 568] = "DWG_TYPE_ASSOCTRIMSURFACEACTIONBODY", n[n.DWG_TYPE_ASSOCVALUEDEPENDENCY = 569] = "DWG_TYPE_ASSOCVALUEDEPENDENCY", n[n.DWG_TYPE_ASSOCVARIABLE = 570] = "DWG_TYPE_ASSOCVARIABLE", n[n.DWG_TYPE_ASSOCVERTEXACTIONPARAM = 571] = "DWG_TYPE_ASSOCVERTEXACTIONPARAM", n[n.DWG_TYPE_BASEPOINTPARAMETERENTITY = 572] = "DWG_TYPE_BASEPOINTPARAMETERENTITY", n[n.DWG_TYPE_BLKREFOBJECTCONTEXTDATA = 573] = "DWG_TYPE_BLKREFOBJECTCONTEXTDATA", n[n.DWG_TYPE_BLOCKALIGNEDCONSTRAINTPARAMETER = 574] = "DWG_TYPE_BLOCKALIGNEDCONSTRAINTPARAMETER", n[n.DWG_TYPE_BLOCKALIGNMENTGRIP = 575] = "DWG_TYPE_BLOCKALIGNMENTGRIP", n[n.DWG_TYPE_BLOCKALIGNMENTPARAMETER = 576] = "DWG_TYPE_BLOCKALIGNMENTPARAMETER", n[n.DWG_TYPE_BLOCKANGULARCONSTRAINTPARAMETER = 577] = "DWG_TYPE_BLOCKANGULARCONSTRAINTPARAMETER", n[n.DWG_TYPE_BLOCKARRAYACTION = 578] = "DWG_TYPE_BLOCKARRAYACTION", n[n.DWG_TYPE_BLOCKBASEPOINTPARAMETER = 579] = "DWG_TYPE_BLOCKBASEPOINTPARAMETER", n[n.DWG_TYPE_BLOCKDIAMETRICCONSTRAINTPARAMETER = 580] = "DWG_TYPE_BLOCKDIAMETRICCONSTRAINTPARAMETER", n[n.DWG_TYPE_BLOCKFLIPACTION = 581] = "DWG_TYPE_BLOCKFLIPACTION", n[n.DWG_TYPE_BLOCKFLIPGRIP = 582] = "DWG_TYPE_BLOCKFLIPGRIP", n[n.DWG_TYPE_BLOCKFLIPPARAMETER = 583] = "DWG_TYPE_BLOCKFLIPPARAMETER", n[n.DWG_TYPE_BLOCKGRIPLOCATIONCOMPONENT = 584] = "DWG_TYPE_BLOCKGRIPLOCATIONCOMPONENT", n[n.DWG_TYPE_BLOCKHORIZONTALCONSTRAINTPARAMETER = 585] = "DWG_TYPE_BLOCKHORIZONTALCONSTRAINTPARAMETER", n[n.DWG_TYPE_BLOCKLINEARCONSTRAINTPARAMETER = 586] = "DWG_TYPE_BLOCKLINEARCONSTRAINTPARAMETER", n[n.DWG_TYPE_BLOCKLINEARGRIP = 587] = "DWG_TYPE_BLOCKLINEARGRIP", n[n.DWG_TYPE_BLOCKLINEARPARAMETER = 588] = "DWG_TYPE_BLOCKLINEARPARAMETER", n[n.DWG_TYPE_BLOCKLOOKUPACTION = 589] = "DWG_TYPE_BLOCKLOOKUPACTION", n[n.DWG_TYPE_BLOCKLOOKUPGRIP = 590] = "DWG_TYPE_BLOCKLOOKUPGRIP", n[n.DWG_TYPE_BLOCKLOOKUPPARAMETER = 591] = "DWG_TYPE_BLOCKLOOKUPPARAMETER", n[n.DWG_TYPE_BLOCKMOVEACTION = 592] = "DWG_TYPE_BLOCKMOVEACTION", n[n.DWG_TYPE_BLOCKPARAMDEPENDENCYBODY = 593] = "DWG_TYPE_BLOCKPARAMDEPENDENCYBODY", n[n.DWG_TYPE_BLOCKPOINTPARAMETER = 594] = "DWG_TYPE_BLOCKPOINTPARAMETER", n[n.DWG_TYPE_BLOCKPOLARGRIP = 595] = "DWG_TYPE_BLOCKPOLARGRIP", n[n.DWG_TYPE_BLOCKPOLARPARAMETER = 596] = "DWG_TYPE_BLOCKPOLARPARAMETER", n[n.DWG_TYPE_BLOCKPOLARSTRETCHACTION = 597] = "DWG_TYPE_BLOCKPOLARSTRETCHACTION", n[n.DWG_TYPE_BLOCKPROPERTIESTABLE = 598] = "DWG_TYPE_BLOCKPROPERTIESTABLE", n[n.DWG_TYPE_BLOCKPROPERTIESTABLEGRIP = 599] = "DWG_TYPE_BLOCKPROPERTIESTABLEGRIP", n[n.DWG_TYPE_BLOCKRADIALCONSTRAINTPARAMETER = 600] = "DWG_TYPE_BLOCKRADIALCONSTRAINTPARAMETER", n[n.DWG_TYPE_BLOCKREPRESENTATION = 601] = "DWG_TYPE_BLOCKREPRESENTATION", n[n.DWG_TYPE_BLOCKROTATEACTION = 602] = "DWG_TYPE_BLOCKROTATEACTION", n[n.DWG_TYPE_BLOCKROTATIONGRIP = 603] = "DWG_TYPE_BLOCKROTATIONGRIP", n[n.DWG_TYPE_BLOCKROTATIONPARAMETER = 604] = "DWG_TYPE_BLOCKROTATIONPARAMETER", n[n.DWG_TYPE_BLOCKSCALEACTION = 605] = "DWG_TYPE_BLOCKSCALEACTION", n[n.DWG_TYPE_BLOCKSTRETCHACTION = 606] = "DWG_TYPE_BLOCKSTRETCHACTION", n[n.DWG_TYPE_BLOCKUSERPARAMETER = 607] = "DWG_TYPE_BLOCKUSERPARAMETER", n[n.DWG_TYPE_BLOCKVERTICALCONSTRAINTPARAMETER = 608] = "DWG_TYPE_BLOCKVERTICALCONSTRAINTPARAMETER", n[n.DWG_TYPE_BLOCKVISIBILITYGRIP = 609] = "DWG_TYPE_BLOCKVISIBILITYGRIP", n[n.DWG_TYPE_BLOCKVISIBILITYPARAMETER = 610] = "DWG_TYPE_BLOCKVISIBILITYPARAMETER", n[n.DWG_TYPE_BLOCKXYGRIP = 611] = "DWG_TYPE_BLOCKXYGRIP", n[n.DWG_TYPE_BLOCKXYPARAMETER = 612] = "DWG_TYPE_BLOCKXYPARAMETER", n[n.DWG_TYPE_CAMERA = 613] = "DWG_TYPE_CAMERA", n[n.DWG_TYPE_CELLSTYLEMAP = 614] = "DWG_TYPE_CELLSTYLEMAP", n[n.DWG_TYPE_CONTEXTDATAMANAGER = 615] = "DWG_TYPE_CONTEXTDATAMANAGER", n[n.DWG_TYPE_CSACDOCUMENTOPTIONS = 616] = "DWG_TYPE_CSACDOCUMENTOPTIONS", n[n.DWG_TYPE_CURVEPATH = 617] = "DWG_TYPE_CURVEPATH", n[n.DWG_TYPE_DATALINK = 618] = "DWG_TYPE_DATALINK", n[n.DWG_TYPE_DATATABLE = 619] = "DWG_TYPE_DATATABLE", n[n.DWG_TYPE_DBCOLOR = 620] = "DWG_TYPE_DBCOLOR", n[n.DWG_TYPE_DETAILVIEWSTYLE = 621] = "DWG_TYPE_DETAILVIEWSTYLE", n[n.DWG_TYPE_DGNDEFINITION = 622] = "DWG_TYPE_DGNDEFINITION", n[n.DWG_TYPE_DGNUNDERLAY = 623] = "DWG_TYPE_DGNUNDERLAY", n[n.DWG_TYPE_DICTIONARYVAR = 624] = "DWG_TYPE_DICTIONARYVAR", n[n.DWG_TYPE_DICTIONARYWDFLT = 625] = "DWG_TYPE_DICTIONARYWDFLT", n[n.DWG_TYPE_DIMASSOC = 626] = "DWG_TYPE_DIMASSOC", n[n.DWG_TYPE_DMDIMOBJECTCONTEXTDATA = 627] = "DWG_TYPE_DMDIMOBJECTCONTEXTDATA", n[n.DWG_TYPE_DWFDEFINITION = 628] = "DWG_TYPE_DWFDEFINITION", n[n.DWG_TYPE_DWFUNDERLAY = 629] = "DWG_TYPE_DWFUNDERLAY", n[n.DWG_TYPE_DYNAMICBLOCKPROXYNODE = 630] = "DWG_TYPE_DYNAMICBLOCKPROXYNODE", n[n.DWG_TYPE_DYNAMICBLOCKPURGEPREVENTER = 631] = "DWG_TYPE_DYNAMICBLOCKPURGEPREVENTER", n[n.DWG_TYPE_EVALUATION_GRAPH = 632] = "DWG_TYPE_EVALUATION_GRAPH", n[n.DWG_TYPE_EXTRUDEDSURFACE = 633] = "DWG_TYPE_EXTRUDEDSURFACE", n[n.DWG_TYPE_FCFOBJECTCONTEXTDATA = 634] = "DWG_TYPE_FCFOBJECTCONTEXTDATA", n[n.DWG_TYPE_FIELD = 635] = "DWG_TYPE_FIELD", n[n.DWG_TYPE_FIELDLIST = 636] = "DWG_TYPE_FIELDLIST", n[n.DWG_TYPE_FLIPPARAMETERENTITY = 637] = "DWG_TYPE_FLIPPARAMETERENTITY", n[n.DWG_TYPE_FLIPACTIONENTITY = 638] = "DWG_TYPE_FLIPACTIONENTITY", n[n.DWG_TYPE_GEODATA = 639] = "DWG_TYPE_GEODATA", n[n.DWG_TYPE_GEOMAPIMAGE = 640] = "DWG_TYPE_GEOMAPIMAGE", n[n.DWG_TYPE_GEOPOSITIONMARKER = 641] = "DWG_TYPE_GEOPOSITIONMARKER", n[n.DWG_TYPE_GRADIENT_BACKGROUND = 642] = "DWG_TYPE_GRADIENT_BACKGROUND", n[n.DWG_TYPE_GROUND_PLANE_BACKGROUND = 643] = "DWG_TYPE_GROUND_PLANE_BACKGROUND", n[n.DWG_TYPE_HELIX = 644] = "DWG_TYPE_HELIX", n[n.DWG_TYPE_IBL_BACKGROUND = 645] = "DWG_TYPE_IBL_BACKGROUND", n[n.DWG_TYPE_IDBUFFER = 646] = "DWG_TYPE_IDBUFFER", n[n.DWG_TYPE_IMAGE = 647] = "DWG_TYPE_IMAGE", n[n.DWG_TYPE_IMAGEDEF = 648] = "DWG_TYPE_IMAGEDEF", n[n.DWG_TYPE_IMAGEDEF_REACTOR = 649] = "DWG_TYPE_IMAGEDEF_REACTOR", n[n.DWG_TYPE_IMAGE_BACKGROUND = 650] = "DWG_TYPE_IMAGE_BACKGROUND", n[n.DWG_TYPE_INDEX = 651] = "DWG_TYPE_INDEX", n[n.DWG_TYPE_LARGE_RADIAL_DIMENSION = 652] = "DWG_TYPE_LARGE_RADIAL_DIMENSION", n[n.DWG_TYPE_LAYERFILTER = 653] = "DWG_TYPE_LAYERFILTER", n[n.DWG_TYPE_LAYER_INDEX = 654] = "DWG_TYPE_LAYER_INDEX", n[n.DWG_TYPE_LAYOUTPRINTCONFIG = 655] = "DWG_TYPE_LAYOUTPRINTCONFIG", n[n.DWG_TYPE_LEADEROBJECTCONTEXTDATA = 656] = "DWG_TYPE_LEADEROBJECTCONTEXTDATA", n[n.DWG_TYPE_LIGHT = 657] = "DWG_TYPE_LIGHT", n[n.DWG_TYPE_LIGHTLIST = 658] = "DWG_TYPE_LIGHTLIST", n[n.DWG_TYPE_LINEARPARAMETERENTITY = 659] = "DWG_TYPE_LINEARPARAMETERENTITY", n[n.DWG_TYPE_LOFTEDSURFACE = 660] = "DWG_TYPE_LOFTEDSURFACE", n[n.DWG_TYPE_MATERIAL = 661] = "DWG_TYPE_MATERIAL", n[n.DWG_TYPE_MENTALRAYRENDERSETTINGS = 662] = "DWG_TYPE_MENTALRAYRENDERSETTINGS", n[n.DWG_TYPE_MESH = 663] = "DWG_TYPE_MESH", n[n.DWG_TYPE_MLEADEROBJECTCONTEXTDATA = 664] = "DWG_TYPE_MLEADEROBJECTCONTEXTDATA", n[n.DWG_TYPE_MLEADERSTYLE = 665] = "DWG_TYPE_MLEADERSTYLE", n[n.DWG_TYPE_MOVEACTIONENTITY = 666] = "DWG_TYPE_MOVEACTIONENTITY", n[n.DWG_TYPE_MOTIONPATH = 667] = "DWG_TYPE_MOTIONPATH", n[n.DWG_TYPE_MPOLYGON = 668] = "DWG_TYPE_MPOLYGON", n[n.DWG_TYPE_MTEXTATTRIBUTEOBJECTCONTEXTDATA = 669] = "DWG_TYPE_MTEXTATTRIBUTEOBJECTCONTEXTDATA", n[n.DWG_TYPE_MTEXTOBJECTCONTEXTDATA = 670] = "DWG_TYPE_MTEXTOBJECTCONTEXTDATA", n[n.DWG_TYPE_MULTILEADER = 671] = "DWG_TYPE_MULTILEADER", n[n.DWG_TYPE_NAVISWORKSMODEL = 672] = "DWG_TYPE_NAVISWORKSMODEL", n[n.DWG_TYPE_NAVISWORKSMODELDEF = 673] = "DWG_TYPE_NAVISWORKSMODELDEF", n[n.DWG_TYPE_NPOCOLLECTION = 674] = "DWG_TYPE_NPOCOLLECTION", n[n.DWG_TYPE_NURBSURFACE = 675] = "DWG_TYPE_NURBSURFACE", n[n.DWG_TYPE_OBJECT_PTR = 676] = "DWG_TYPE_OBJECT_PTR", n[n.DWG_TYPE_ORDDIMOBJECTCONTEXTDATA = 677] = "DWG_TYPE_ORDDIMOBJECTCONTEXTDATA", n[n.DWG_TYPE_PARTIAL_VIEWING_INDEX = 678] = "DWG_TYPE_PARTIAL_VIEWING_INDEX", n[n.DWG_TYPE_PDFDEFINITION = 679] = "DWG_TYPE_PDFDEFINITION", n[n.DWG_TYPE_PDFUNDERLAY = 680] = "DWG_TYPE_PDFUNDERLAY", n[n.DWG_TYPE_PERSUBENTMGR = 681] = "DWG_TYPE_PERSUBENTMGR", n[n.DWG_TYPE_PLANESURFACE = 682] = "DWG_TYPE_PLANESURFACE", n[n.DWG_TYPE_PLOTSETTINGS = 683] = "DWG_TYPE_PLOTSETTINGS", n[n.DWG_TYPE_POINTCLOUD = 684] = "DWG_TYPE_POINTCLOUD", n[n.DWG_TYPE_POINTCLOUDCOLORMAP = 685] = "DWG_TYPE_POINTCLOUDCOLORMAP", n[n.DWG_TYPE_POINTCLOUDDEF = 686] = "DWG_TYPE_POINTCLOUDDEF", n[n.DWG_TYPE_POINTCLOUDDEFEX = 687] = "DWG_TYPE_POINTCLOUDDEFEX", n[n.DWG_TYPE_POINTCLOUDDEF_REACTOR = 688] = "DWG_TYPE_POINTCLOUDDEF_REACTOR", n[n.DWG_TYPE_POINTCLOUDDEF_REACTOR_EX = 689] = "DWG_TYPE_POINTCLOUDDEF_REACTOR_EX", n[n.DWG_TYPE_POINTCLOUDEX = 690] = "DWG_TYPE_POINTCLOUDEX", n[n.DWG_TYPE_POINTPARAMETERENTITY = 691] = "DWG_TYPE_POINTPARAMETERENTITY", n[n.DWG_TYPE_POINTPATH = 692] = "DWG_TYPE_POINTPATH", n[n.DWG_TYPE_POLARGRIPENTITY = 693] = "DWG_TYPE_POLARGRIPENTITY", n[n.DWG_TYPE_RADIMLGOBJECTCONTEXTDATA = 694] = "DWG_TYPE_RADIMLGOBJECTCONTEXTDATA", n[n.DWG_TYPE_RADIMOBJECTCONTEXTDATA = 695] = "DWG_TYPE_RADIMOBJECTCONTEXTDATA", n[n.DWG_TYPE_RAPIDRTRENDERSETTINGS = 696] = "DWG_TYPE_RAPIDRTRENDERSETTINGS", n[n.DWG_TYPE_RASTERVARIABLES = 697] = "DWG_TYPE_RASTERVARIABLES", n[n.DWG_TYPE_RENDERENTRY = 698] = "DWG_TYPE_RENDERENTRY", n[n.DWG_TYPE_RENDERENVIRONMENT = 699] = "DWG_TYPE_RENDERENVIRONMENT", n[n.DWG_TYPE_RENDERGLOBAL = 700] = "DWG_TYPE_RENDERGLOBAL", n[n.DWG_TYPE_RENDERSETTINGS = 701] = "DWG_TYPE_RENDERSETTINGS", n[n.DWG_TYPE_REVOLVEDSURFACE = 702] = "DWG_TYPE_REVOLVEDSURFACE", n[n.DWG_TYPE_ROTATIONPARAMETERENTITY = 703] = "DWG_TYPE_ROTATIONPARAMETERENTITY", n[n.DWG_TYPE_ROTATEACTIONENTITY = 704] = "DWG_TYPE_ROTATEACTIONENTITY", n[n.DWG_TYPE_RTEXT = 705] = "DWG_TYPE_RTEXT", n[n.DWG_TYPE_SCALE = 706] = "DWG_TYPE_SCALE", n[n.DWG_TYPE_SCALEACTIONENTITY = 707] = "DWG_TYPE_SCALEACTIONENTITY", n[n.DWG_TYPE_SECTIONOBJECT = 708] = "DWG_TYPE_SECTIONOBJECT", n[n.DWG_TYPE_SECTIONVIEWSTYLE = 709] = "DWG_TYPE_SECTIONVIEWSTYLE", n[n.DWG_TYPE_SECTION_MANAGER = 710] = "DWG_TYPE_SECTION_MANAGER", n[n.DWG_TYPE_SECTION_SETTINGS = 711] = "DWG_TYPE_SECTION_SETTINGS", n[n.DWG_TYPE_SKYLIGHT_BACKGROUND = 712] = "DWG_TYPE_SKYLIGHT_BACKGROUND", n[n.DWG_TYPE_SOLID_BACKGROUND = 713] = "DWG_TYPE_SOLID_BACKGROUND", n[n.DWG_TYPE_SORTENTSTABLE = 714] = "DWG_TYPE_SORTENTSTABLE", n[n.DWG_TYPE_SPATIAL_FILTER = 715] = "DWG_TYPE_SPATIAL_FILTER", n[n.DWG_TYPE_SPATIAL_INDEX = 716] = "DWG_TYPE_SPATIAL_INDEX", n[n.DWG_TYPE_STRETCHACTIONENTITY = 717] = "DWG_TYPE_STRETCHACTIONENTITY", n[n.DWG_TYPE_SUN = 718] = "DWG_TYPE_SUN", n[n.DWG_TYPE_SUNSTUDY = 719] = "DWG_TYPE_SUNSTUDY", n[n.DWG_TYPE_SWEPTSURFACE = 720] = "DWG_TYPE_SWEPTSURFACE", n[n.DWG_TYPE_TABLE = 721] = "DWG_TYPE_TABLE", n[n.DWG_TYPE_TABLECONTENT = 722] = "DWG_TYPE_TABLECONTENT", n[n.DWG_TYPE_TABLEGEOMETRY = 723] = "DWG_TYPE_TABLEGEOMETRY", n[n.DWG_TYPE_TABLESTYLE = 724] = "DWG_TYPE_TABLESTYLE", n[n.DWG_TYPE_TEXTOBJECTCONTEXTDATA = 725] = "DWG_TYPE_TEXTOBJECTCONTEXTDATA", n[n.DWG_TYPE_TVDEVICEPROPERTIES = 726] = "DWG_TYPE_TVDEVICEPROPERTIES", n[n.DWG_TYPE_VISIBILITYGRIPENTITY = 727] = "DWG_TYPE_VISIBILITYGRIPENTITY", n[n.DWG_TYPE_VISIBILITYPARAMETERENTITY = 728] = "DWG_TYPE_VISIBILITYPARAMETERENTITY", n[n.DWG_TYPE_VISUALSTYLE = 729] = "DWG_TYPE_VISUALSTYLE", n[n.DWG_TYPE_WIPEOUT = 730] = "DWG_TYPE_WIPEOUT", n[n.DWG_TYPE_WIPEOUTVARIABLES = 731] = "DWG_TYPE_WIPEOUTVARIABLES", n[n.DWG_TYPE_XREFPANELOBJECT = 732] = "DWG_TYPE_XREFPANELOBJECT", n[n.DWG_TYPE_XYPARAMETERENTITY = 733] = "DWG_TYPE_XYPARAMETERENTITY", n[n.DWG_TYPE_BREAKDATA = 734] = "DWG_TYPE_BREAKDATA", n[n.DWG_TYPE_BREAKPOINTREF = 735] = "DWG_TYPE_BREAKPOINTREF", n[n.DWG_TYPE_FLIPGRIPENTITY = 736] = "DWG_TYPE_FLIPGRIPENTITY", n[n.DWG_TYPE_LINEARGRIPENTITY = 737] = "DWG_TYPE_LINEARGRIPENTITY", n[n.DWG_TYPE_ROTATIONGRIPENTITY = 738] = "DWG_TYPE_ROTATIONGRIPENTITY", n[n.DWG_TYPE_XYGRIPENTITY = 739] = "DWG_TYPE_XYGRIPENTITY", n[n.DWG_TYPE__3DLINE = 740] = "DWG_TYPE__3DLINE", n[n.DWG_TYPE_REPEAT = 741] = "DWG_TYPE_REPEAT", n[n.DWG_TYPE_ENDREP = 742] = "DWG_TYPE_ENDREP", n[n.DWG_TYPE_JUMP = 743] = "DWG_TYPE_JUMP", n[n.DWG_TYPE_LOAD = 744] = "DWG_TYPE_LOAD", n[n.DWG_TYPE_FREED = 65533] = "DWG_TYPE_FREED", n[n.DWG_TYPE_UNKNOWN_ENT = 65534] = "DWG_TYPE_UNKNOWN_ENT", n[n.DWG_TYPE_UNKNOWN_OBJ = 65535] = "DWG_TYPE_UNKNOWN_OBJ"; })(P || (P = {})); const bn = Object.fromEntries(Object.entries(P).map(([n, t]) => [t, n])); var ct; (function(n) { n[n.DWG = 0] = "DWG", n[n.DXF = 1] = "DXF"; })(ct || (ct = {})); var U; (function(n) { n[n.Line = 1] = "Line", n[n.CircularArc = 2] = "CircularArc", n[n.EllipticArc = 3] = "EllipticArc", n[n.Spline = 4] = "Spline"; })(U || (U = {})); var pt; (function(n) { n[n.ByLayer = 192] = "ByLayer", n[n.ByBlock = 193] = "ByBlock", n[n.Entities = 194] = "Entities", n[n.TrueColor = 195] = "TrueColor", n[n.ForegroundColor = 197] = "ForegroundColor", n[n.None = 200] = "None"; })(pt || (pt = {})); const gn = "*MODEL_SPACE", yn = "*PAPER_SPACE", Bt = (n) => n && n.toUpperCase() == gn, xn = (n) => n && n.toUpperCase().startsWith(yn), L = (n) => n.toString(16).toUpperCase(); class pn { constructor(t) { N(this, "libredwg"); N(this, "layers", /* @__PURE__ */ new Map()); N(this, "ltypes", /* @__PURE__ */ new Map()); N(this, "unknownEntityCount"); this.libredwg = t, this.unknownEntityCount = 0; } prepare(t, e = !1) { (e || this.layers.size == 0) && (this.layers.clear(), t.tables.LAYER.entries.forEach((a) => { this.layers.set(a.handle, a.name); })), (e || this.ltypes.size == 0) && (this.ltypes.clear(), t.tables.LTYPE.entries.forEach((a) => { this.ltypes.set(a.handle, a.name); })), this.unknownEntityCount = 0; } clear() { this.layers.clear(), this.ltypes.clear(), this.unknownEntityCount = 0; } convert(t) { const e = this.libredwg, a = e.dwg_object_to_entity(t), _ = e.dwg_object_to_entity_tio(t); if (a && _) { const o = this.getCommonAttrs(a), i = e.dwg_object_get_fixedtype(t); if (i == P.DWG_TYPE_3DFACE) return this.convert3dFace(_, o); if (i == P.DWG_TYPE_ARC) return this.convertArc(_, o); if (i == P.DWG_TYPE_ATTDEF) return this.convertAttdef(_, o); if (i == P.DWG_TYPE_CIRCLE) return this.convertCircle(_, o); if (i == P.DWG_TYPE_DIMENSION_ALIGNED || i == P.DWG_TYPE_DIMENSION_LINEAR) return this.convertAlignedDimension(_, o); if (i == P.DWG_TYPE_DIMENSION_ANG3PT) return this.convert3PointAngularDimension(_, o); if (i == P.DWG_TYPE_DIMENSION_DIAMETER) return this.convertDiameterDimension(_, o); if (i == P.DWG_TYPE_DIMENSION_ORDINATE) return this.convertOrdinateDimension(_, o); if (i == P.DWG_TYPE_DIMENSION_RADIUS) return this.convertRadiusDimension(_, o); if (i == P.DWG_TYPE_ELLIPSE) return this.convertEllise(_, o); if (i == P.DWG_TYPE_HATCH) return this.convertHatch(_, o); if (i == P.DWG_TYPE_IMAGE) return this.convertImage(_, o); if (i == P.DWG_TYPE_INSERT) return this.convertInsert(_, o); if (i == P.DWG_TYPE_LEADER) return this.convertLeader(_, o); if (i == P.DWG_TYPE_LINE) return this.convertLine(_, o); if (i == P.DWG_TYPE_LWPOLYLINE) return this.convertLWPolyline(_, o); if (i == P.DWG_TYPE_MLINE) return this.convertMLine(_, o); if (i == P.DWG_TYPE_MTEXT) return this.convertMText(_, o); if (i == P.DWG_TYPE_OLE2FRAME) return this.convertOle2Frame(_, o); if (i == P.DWG_TYPE_OLEFRAME) return this.convertOleFrame(_, o); if (i == P.DWG_TYPE_POINT) return this.convertPoint(_, o); if (i == P.DWG_TYPE_POLYLINE_2D) return this.convertPolyline2d(_, o, t); if (i == P.DWG_TYPE_POLYLINE_3D) return this.convertPolyline3d(_, o, t); if (i == P.DWG_TYPE_PROXY_ENTITY) return this.convertProxy(_, o); if (i == P.DWG_TYPE_RAY) return this.convertRay(_, o); if (i == P.DWG_TYPE_SECTIONOBJECT) return this.convertSection(_, o); if (i == P.DWG_TYPE_SOLID) return this.convertSolid(_, o); if (i == P.DWG_TYPE_SPLINE) return this.convertSpline(_, o); if (i == P.DWG_TYPE_TABLE) return this.convertTable(_, o); if (i == P.DWG_TYPE_TEXT) return this.convertText(_, o); if (i == P.DWG_TYPE_TOLERANCE) return this.convertTolerance(_, o); if (i == P.DWG_TYPE_VIEWPORT) return this.convertViewport(_, o); if (i == P.DWG_TYPE_WIPEOUT) return this.convertWipeout(_, o); if (i == P.DWG_TYPE_XLINE) return this.convertXline(_, o); i === P.DWG_TYPE_UNKNOWN_ENT && this.unknownEntityCount++; } } convert3dFace(t, e) { const a = this.libredwg, _ = a.dwg_dynapi_entity_value(t, "corner1").data, o = a.dwg_dynapi_entity_value(t, "corner2").data, i = a.dwg_dynapi_entity_value(t, "corner3").data, s = a.dwg_dynapi_entity_value(t, "corner4").data, r = a.dwg_dynapi_entity_value(t, "invis_flags").data; return { type: "3DFACE", ...e, corner1: _, corner2: o, corner3: i, corner4: s, flag: r }; } convertArc(t, e) { const a = this.libredwg, _ = a.dwg_dynapi_entity_value(t, "center").data, o = a.dwg_dynapi_entity_value(t, "radius").data, i = a.dwg_dynapi_entity_value(t, "thickness").data, s = a.dwg_dynapi_entity_value(t, "extrusion").data, r = a.dwg_dynapi_entity_value(t, "start_angle").data, l = a.dwg_dynapi_entity_value(t, "end_angle").data; return { type: "ARC", ...e, thickness: i, center: _, radius: o, startAngle: r, endAngle: l, extrusionDirection: s }; } convertEmbeddedMText(t, e) { const a = this.libredwg, _ = a.dwg_dynapi_subclass_value(t, e, "attachment").data, o = a.dwg_dynapi_subclass_value(t, e, "ins_pt").data, i = a.dwg_dynapi_subclass_value(t, e, "x_axis_dir").data, s = a.dwg_dynapi_subclass_value(t, e, "rect_height").data, r = a.dwg_dynapi_subclass_value(t, e, "rect_width").data, l = a.dwg_dynapi_subclass_value(t, e, "extents_height").data, d = a.dwg_dynapi_subclass_value(t, e, "extents_width").data; return { insertionPoint: o, rectHeight: s, rectWidth: r, extentsHeight: l, extentsWidth: d, attachmentPoint: _, direction: i // columnType: columnType, // columnFlowReversed: columnFlowReversed, // columnAutoHeight: columnAutoHeight, // columnWidth: columnWidth, // columnGutter: columnGutter, // columnHeightCount: columnHeightCount, // columnHeights: columnHeights }; } convertAttdef(t, e) { const a = this.libredwg, _ = a.dwg_dynapi_entity_value(t, "default_value").data, o = this.convertTextBase(t); o.text = _; const i = a.dwg_dynapi_entity_value(t, "prompt").data, s = a.dwg_dynapi_entity_value(t, "tag").data, r = a.dwg_dynapi_entity_value(t, "flags").data, l = a.dwg_dynapi_entity_value(t, "field_length").data, d = a.dwg_dynapi_entity_value(t, "lock_position_flag").data, I = a.dwg_dynapi_entity_value(t, "keep_duplicate_records").data, c = a.dwg_dynapi_entity_value(t, "is_really_locked").data, E = a.dwg_dynapi_entity_value(t, "mtext_type").data, C = a.dwg_dynapi_entity_value(t, "alignment_pt").data; return { type: "ATTDEF", ...e, text: this.convertTextBase(t), prompt: i, tag: s, flags: r, fieldLength: l, lockPositionFlag: d > 0, duplicateRecordCloningFlag: I > 0, mtextFlag: E, isReallyLocked: c > 0, alignmentPoint: C, annotationScale: 1, // TODO: Set the correct value attrTag: "", // TODO: Set the correct value mtext: this.convertEmbeddedMText(t, "ATTDEF_mtext") }; } convertAttrib(t, e) { const a = this.libredwg, _ = this.convertTextBase(t), o = a.dwg_dynapi_entity_value(t, "tag").data, i = a.dwg_dynapi_entity_value(t, "flags").data, s = a.dwg_dynapi_entity_value(t, "field_length").data, r = a.dwg_dynapi_entity_value(t, "lock_position_flag").data, l = a.dwg_dynapi_entity_value(t, "keep_duplicate_records").data, d = a.dwg_dynapi_entity_value(t, "mtext_type").data, I = a.dwg_dynapi_entity_value(t, "is_really_locked").data, c = a.dwg_dynapi_entity_value(t, "alignment_pt").data; return { type: "ATTRIB", ...e, text: _, tag: o, flags: i, fieldLength: s, lockPositionFlag: !!r, duplicateRecordCloningFlag: !!l, mtextFlag: d, isReallyLocked: !!I, numberOfSecondaryAttrs: 0, // TODO: libredwg doesn't support it yet. secondaryAttrsHardId: "0", // TODO: libredwg doesn't support it yet. alignmentPoint: { ...c, z: 0 }, annotationScale: 1, // TODO: Set the correct value attrTag: "", // TODO: Set the correct value mtext: this.convertEmbeddedMText(t, "ATTDEF_mtext") }; } convertCircle(t, e) { const a = this.libredwg, _ = a.dwg_dynapi_entity_value(t, "center").data, o = a.dwg_dynapi_entity_value(t, "radius").data, i = a.dwg_dynapi_entity_value(t, "thickness").data, s = a.dwg_dynapi_entity_value(t, "extrusion").data; return { type: "CIRCLE", ...e, thickness: i, center: _, radius: o, extrusionDirection: s }; } convertAlignedDimension(t, e) { const a = this.libredwg, _ = this.getDimensionCommonAttrs(t), o = a.dwg_dynapi_entity_value(t, "clone_ins_pt").data, i = a.dwg_dynapi_entity_value(t, "xline1_pt").data, s = a.dwg_dynapi_entity_value(t, "xline2_pt").data, r = a.dwg_dynapi_entity_value(t, "ins_rotation").data, l = a.dwg_dynapi_entity_value(t, "oblique_angle").data; return { subclassMarker: "AcDbAlignedDimension", ...e, ..._, insertionPoint: o, subDefinitionPoint1: i, subDefinitionPoint2: s, rotationAngle: r ?? 0, obliqueAngle: l }; } convert3PointAngularDimension(t, e) { const a = this.libredwg, _ = this.getDimensionCommonAttrs(t), o = a.dwg_dynapi_entity_value(t, "xline1_pt").data, i = a.dwg_dynapi_entity_value(t, "xline2_pt").data, s = a.dwg_dynapi_entity_value(t, "center_pt").data, r = a.dwg_dynapi_entity_value(t, "xline2end_pt").data; return { subclassMarker: "AcDb3PointAngularDimension", ...e, ..._, subDefinitionPoint1: o, subDefinitionPoint2: i, centerPoint: s, arcPoint: r }; } convertDiameterDimension(t, e) { const a = this.libredwg, _ = this.getDimensionCommonAttrs(t), o = a.dwg_dynapi_entity_value(t, "first_arc_pt").data, i = a.dwg_dynapi_entity_value(t, "leader_len").data; return { subclassMarker: "AcDbDiametricDimension", ...e, ..._, centerPoint: o, leaderLength: i }; } convertOrdinateDimension(t, e) { const a = this.libredwg, _ = this.getDimensionCommonAttrs(t), o = a.dwg_dynapi_entity_value(t, "feature_location_pt").data, i = a.dwg_dynapi_entity_value(t, "leader_endpt").data; return { subclassMarker: "AcDbOrdinateDimension", ...e, ..._, subDefinitionPoint1: o, subDefinitionPoint2: i }; } convertRadiusDimension(t, e) { const a = this.libredwg, _ = this.getDimensionCommonAttrs(t), o = a.dwg_dynapi_entity_value(t, "first_arc_pt").data, i = a.dwg_dynapi_entity_value(t, "leader_len").data; return { subclassMarker: "AcDbRadialDimension", ...e, ..._, centerPoint: o, leaderLength: i }; } convertEllise(t, e) { const a = this.libredwg, _ = a.dwg_dynapi_entity_value(t, "center").data, o = a.dwg_dynapi_entity_value(t, "sm_axis").data, i = a.dwg_dynapi_entity_value(t, "extrusion").data, s = a.dwg_dynapi_entity_value(t, "axis_ratio").data, r = a.dwg_dynapi_entity_value(t, "start_angle").data, l = a.dwg_dynapi_entity_value(t, "end_angle").data; return { type: "ELLIPSE", ...e, center: _, majorAxisEndPoint: o, extrusionDirection: i, axisRatio: s, startAngle: r, endAngle: l }; } convertHatch(t, e) { const a = this.libredwg, _ = a.dwg_dynapi_entity_value(t, "extrusion").data, o = a.dwg_dynapi_entity_value(t, "name").data, i = a.dwg_dynapi_entity_value(t, "is_solid_fill").data, s = a.dwg_dynapi_entity_value(t, "is_associative").data, r = a.dwg_dynapi_entity_value(t, "num_paths").data, l = a.dwg_dynapi_entity_value(t, "paths").data, d = a.dwg_ptr_to_hatch_path_array(l, r), I = a.dwg_dynapi_entity_value(t, "style").data, c = a.dwg_dynapi_entity_value(t, "pattern_type").data, E = a.dwg_dynapi_entity_value(t, "angle").data, C = a.dwg_dynapi_entity_value(t, "scale_spacing").data, A = a.dwg_dynapi_entity_value(t, "num_deflines").data, u = a.dwg_dynapi_entity_value(t, "deflines").data, T = a.dwg_ptr_to_hatch_defline_array(u, A), h = a.dwg_dynapi_entity_value(t, "pixel_size").data, Y = a.dwg_dynapi_entity_value(t, "num_seeds").data, R = a.dwg_dynapi_entity_value(t, "seeds").data, f = a.dwg_ptr_to_point2d_array(R, Y), v = { ...e, // elevationPoint: DwgPoint3D extrusionDirection: _, patternName: o, solidFill: i ? z.SolidFill : z.PatternFill, // patternFillColor: number associativity: s ? Z.Associative : Z.NonAssociative, numberOfBoundaryPaths: r, boundaryPaths: this.convertHatchBoundaryPaths(d), hatchStyle: I, patternType: c, patternAngle: E, patternScale: C, numberOfDefinitionLines: A, definitionLines: T.map((S) => ({ angle: S.angle, base: S.pt0, offset: S.offset, numberOfDashLengths: S.dashes.length, dashLengths: S.dashes })), pixelSize: h, numberOfSeedPoints: Y, // offsetVector?: DwgPoint3D seedPoints: f // gradientFlag?: DwgHatchGradientFlag }; if (a.dwg_dynapi_entity_value(t, "is_gradient_fill").data > 0) { const S = a.dwg_dynapi_entity_value(t, "gradient_name").data, y = a.dwg_dynapi_entity_value(t, "gradient_angle").data, x = a.dwg_dynapi_entity_value(t, "gradient_shift").data, M = a.dwg_dynapi_entity_value(t, "gradient_tint").data, g = a.dwg_dynapi_entity_value(t, "single_color_gradient").data, p = a.dwg_dynapi_entity_value(t, "colors").data, O = a.dwg_ptr_to_hatch_gradient_color_array(p, g == 1 ? 1 : 2); return { type: "HATCH", ...v, gradientFlag: Et.Gradient, gradientColorFlag: g == 1 ? q.OneColor : q.TwoColor, gradientName: S, gradientRotation: y, gradientDefinition: x, colorTint: M, gradientColors: O }; } else return { type: "HATCH", ...v }; } convertHatchBoundaryPaths(t) { return t.filter((a) => a.num_segs_or_paths > 0).map((a) => { const _ = { boundaryPathTypeFlag: a.flag }; if (a.flag & 2) return { ..._, hasBulge: a.bulges_present, isClosed: a.closed, numberOfVertices: a.num_segs_or_paths, vertices: a.polyline_paths.map((o) => ({ x: o.point.x, y: o.point.y, bulge: o.bulge })) }; { const o = a.segs.map((i) => { if (i.curve_type == U.Line) return { type: F.Line, start: i.first_endpoint, end: i.second_endpoint }; if (i.curve_type == U.CircularArc) return { type: F.Circular, center: i.center, radius: i.radius, startAngle: i.start_angle, endAngle: i.end_angle, isCCW: i.is_ccw }; if (i.curve_type == U.EllipticArc) return { type: F.Elliptic, center: i.center, end: i.endpoint, lengthOfMinorAxis: i.minor_major_ratio, startAngle: i.start_angle, endAngle: i.end_angle, isCCW: i.is_ccw }; if (i.curve_type == U.Spline) return { type: F.Spline, degree: i.degree, isRational: i.is_rational, isPeriodic: i.is_periodic, numberOfKnots: i.num_knots, numberOfControlPoints: i.num_control_points, knots: i.knots, controlPoints: i.control_points, numberOfFitData: i.num_fitpts, fitDatum: i.fitpts, startTangent: i.start_tangent, endTangent: i.end_tangent }; }); return { ..._, numberOfEdges: a.num_segs_or_paths, edges: o }; } }); } convertImage(t, e) { const a = this.libredwg, _ = a.dwg_dynapi_entity_value(t, "class_version").data, o = a.dwg_dynapi_entity_value(t, "pt0").data, i = a.dwg_dynapi_entity_value(t, "uvec").data, s = a.dwg_dynapi_entity_value(t, "vvec").data, r = a.dwg_dynapi_entity_value(t, "image_size").data, l = a.dwg_dynapi_entity_value(t, "display_props").data, d = a.dwg_dynapi_entity_value(t, "clipping").data, I = a.dwg_dynapi_entity_value(t, "brightness").data, c = a.dwg_dynapi_entity_value(t, "contrast").data, E = a.dwg_dynapi_entity_value(t, "fade").data, C = a.dwg_dynapi_entity_value(t, "clip_mode").data, A = a.dwg_dynapi_entity_value(t, "clip_boundary_type").data, u = a.dwg_dynapi_entity_value(t, "num_clip_verts").data, T = a.dwg_dynapi_entity_value(t, "clip_verts").data, h = a.dwg_ptr_to_point3d_array(T, u), Y = a.dwg_dynapi_entity_value(t, "imagedef").data, R = L(a.dwg_ref_get_absref(Y)), f = a.dwg_dynapi_entity_value(t, "imagedefreactor").data, v = L(a.dwg_ref_get_absref(f)); return { type: "IMAGE", ...e, version: _, position: o, uPixel: i, vPixel: s, imageSize: r, imageDefHandle: R, flags: l, clipping: d, brightness: I, contrast: c, fade: E, imageDefReactorHandle: v, clippingBoundaryType: A, countBoundaryPoints: u, clippingBoundaryPath: h, clipMode: C }; } convertInsert(t, e) { const a = this.libredwg; let _ = ""; const o = a.dwg_dynapi_entity_value(t, "block_header").data; if (o) { const u = a.dwg_ref_get_object(o); if (u) { const T = a.dwg_object_to_object_tio(u); T && (_ = a.dwg_entity_block_header_get_block(T).name); } } _ || (_ = a.dwg_dynapi_entity_value(t, "block_name").data); const i = a.dwg_dynapi_entity_value(t, "ins_pt").data, s = a.dwg_dynapi_entity_value(t, "scale").data, r = a.dwg_dynapi_entity_value(t, "rotation").data, l = a.dwg_dynapi_entity_value(t, "num_cols").data, d = a.dwg_dynapi_entity_value(t, "num_rows").data, I = a.dwg_dynapi_entity_value(t, "col_spacing").data, c = a.dwg_dynapi_entity_value(t, "row_spacing").data, E = a.dwg_dynapi_entity_value(t, "extrusion").data, C = a.dwg_entity_insert_get_attribs(t), A = []; return C.forEach((u) => { const T = a.dwg_object_to_entity(u), h = a.dwg_object_to_entity_tio(u); if (T && h) { const Y = this.getCommonAttrs(T); a.dwg_object_get_fixedtype(u) == P.DWG_TYPE_ATTRIB && A.push(this.convertAttrib(h, Y)); } }), { type: "INSERT", ...e, name: _, insertionPoint: i, xScale: s ? s.x : 1, yScale: s ? s.y : 1, zScale: s ? s.z : 1, rotation: r, columnCount: l, rowCount: d, columnSpacing: I, rowSpacing: c, extrusionDirection: E, attribs: A }; } convertLeader(t, e) { const a = this.libredwg, _ = a.dwg_entity_mtext_get_style_name(t), o = a.dwg_dynapi_entity_value(t, "arrowhead_type").data, i = a.dwg_dynapi_entity_value(t, "path_type").data, s = a.dwg_dynapi_entity_value(t, "annot_type").data, r = a.dwg_dynapi_entity_value(t, "hookline_dir").data, l = a.dwg_dynapi_entity_value(t, "hookline_on").data, d = a.dwg_dynapi_entity_value(t, "box_height").data, I = a.dwg_dynapi_entity_value(t, "box_width").data, c = a.dwg_dynapi_entity_value(t, "num_points").data, E = a.dwg_dynapi_entity_value(t, "points").data, C = c > 0 ? a.dwg_ptr_to_point3d_array(E, c) : [], A = a.dwg_dynapi_entity_value(t, "byblock_color").data, u = a.dwg_dynapi_entity_value(t, "extrusion").data, T = a.dwg_dynapi_entity_value(t, "x_direction").data, h = a.dwg_dynapi_entity_value(t, "inspt_offset").data, Y = a.dwg_dynapi_entity_value(t, "endptproj").data; return { type: "LEADER", ...e, styleName: _, isArrowheadEnabled: o > 0, isSpline: i > 0, leaderCreationFlag: s, isHooklineSameDirection: r > 0, isHooklineExists: l > 0, textHeight: d, textWidth: I, numberOfVertices: c, vertices: C, byBlockColor: A, normal: u, horizontalDirection: T, offsetFromBlock: h, offsetFromAnnotation: Y }; } convertLine(t, e) { const a = this.libredwg, _ = a.dwg_dynapi_entity_value(t, "start").data, o = a.dwg_dynapi_entity_value(t, "end").data, i = a.dwg_dynapi_entity_value(t, "thickness").data, s = a.dwg_dynapi_entity_value(t, "extrusion").data; return { type: "LINE", ...e, thickness: i, startPoint: _, endPoint: o, extrusionDirection: s }; } convertLWPolyline(t, e) { const a = this.libredwg, _ = a.dwg_dynapi_entity_value(t, "num_points").data, o = a.dwg_dynapi_entity_value(t, "flag").data, i = a.dwg_dynapi_entity_value(t, "const_width").data, s = a.dwg_dynapi_entity_value(t, "elevation").data, r = a.dwg_dynapi_entity_value(t, "thickness").data, l = a.dwg_dynapi_entity_value(t, "extrusion").data, d = [], I = a.dwg_dynapi_entity_value(t, "num_points").data, c = a.dwg_dynapi_entity_value(t, "points").data, E = a.dwg_ptr_to_point2d_array(c, I), C = a.dwg_dynapi_entity_value(t, "num_bulges").data, A = a.dwg_dynapi_entity_value(t, "bulges").data, u = a.dwg_ptr_to_double_array(A, C); return E.forEach((T, h) => { d.push({ id: h, x: T.x, y: T.y, bulge: u.length > h ? u[h] : 0 }); }), { type: "LWPOLYLINE", ...e, numberOfVertices: _, flag: o, constantWidth: i, elevation: s, thickness: r, extrusionDirection: l, vertices: d }; } convertMLine(t, e) { const a = this.libredwg, _ = a.dwg_dynapi_entity_value(t, "scale").data, o = a.dwg_dynapi_entity_value(t, "flags").data, i = a.dwg_dynapi_entity_value(t, "justification").data, s = a.dwg_dynapi_entity_value(t, "base_point").data, r = a.dwg_dynapi_entity_value(t, "extrusion").data, l = a.dwg_dynapi_entity_value(t, "num_lines").data, d = a.dwg_dynapi_entity_value(t, "num_verts").data, I = a.dwg_dynapi_entity_value(t, "verts").data, c = a.dwg_ptr_to_mline_vertex_array(I, d), E = []; return c.forEach((C) => { E.push({ vertex: C.vertex, vertexDirection: C.vertex_direction, miterDirection: C.miter_direction, numberOfLines: C.num_lines, lines: C.lines.map((A) => ({ numberOfSegmentParams: A.num_segparms, segmentParams: A.segparms, numberOfAreaFillParams: A.num_areafillparms, areaFillParams: A.areafillparms })) }); }), { type: "MLINE", ...e, scale: _, flags: o, justification: i, startPoint: s, extrusionDirection: r, numberOfLines: l, numberOfVertices: d, vertices: E, mlineStyle: "" // TODO: Set the correct value }; } convertOle2Frame(t, e) { const a = this.libredwg, _ = a.dwg_dynapi_entity_value(t, "oleversion").data, o = a.dwg_dynapi_entity_value(t, "oleclient").data, i = a.dwg_dynapi_entity_value(t, "data_size").data, s = a.dwg_dynapi_entity_value(t, "pt1").data, r = a.dwg_dynapi_entity_value(t, "pt2").data, l = a.dwg_dynapi_entity_value(t, "lock_aspect").data, d = a.dwg_dynapi_entity_value(t, "type").data, I = a.dwg_dynapi_entity_value(t, "mode").data, c = a.dwg_dynapi_entity_value(t, "data").data; return { type: "OLE2FRAME", ...e, oleVersion: _, oleClient: o, dataSize: i, leftUpPoint: s, rightDownPoint: r, lockAspect: l, oleObjectType: d, tileModeDescriptor: I, binaryData: c }; } convertOleFrame(t, e) { const a = this.libredwg, _ = a.dwg_dynapi_entity_value(t, "flag").data, o = a.dwg_dynapi_entity_value(t, "mode").data, i = a.dwg_dynapi_entity_value(t, "data_size").data, s = a.dwg_dynapi_entity_value(t, "data").data; return { type: "OLEFRAME", ...e, flag: _, mode: o, dataSize: i, binaryData: s }; } convertMText(t, e) { const a = this.libredwg, _ = a.dwg_dynapi_entity_value(t, "ins_pt").data, o = a.dwg_dynapi_entity_value(t, "text_height").data, i = a.dwg_dynapi_entity_value(t, "rect_height").data, s = a.dwg_dynapi_entity_value(t, "rect_width").data, r = a.dwg_dynapi_entity_value(t, "extents_width").data, l = a.dwg_dynapi_entity_value(t, "extents_height").data, d = a.dwg_dynapi_entity_value(t, "attachment").data, I = a.dwg_dynapi_entity_value(t, "flow_dir").data, c = a.dwg_dynapi_entity_value(t, "text").data, E = a.dwg_entity_mtext_get_style_name(t), C = a.dwg_dynapi_entity_value(t, "extrusion").data, A = a.dwg_dynapi_entity_value(t, "x_axis_dir").data, u = a.dwg_dynapi_entity_value(t, "linespace_style").data, T = a.dwg_dynapi_entity_value(t, "linespace_factor").data, h = a.dwg_dynapi_entity_value(t, "bg_fill_flag").data, Y = a.dwg_dynapi_entity_value(t, "bg_fill_scale").data, R = a.dwg_dynapi_entity_value(t, "bg_fill_color").data, f = a.dwg_dynapi_entity_value(t, "bg_fill_trans").data, v = a.dwg_dynapi_entity_value(t, "column_type").data, G = a.dwg_dynapi_entity_value(t, "flow_reversed").data, S = a.dwg_dynapi_entity_value(t, "auto_height").data, y = a.dwg_dynapi_entity_value(t, "column_width").data, x = a.dwg_dynapi_entity_value(t, "gutter").data, M = a.dwg_dynapi_entity_value(t, "num_column_heights").data, g = a.dwg_dynapi_entity_value(t, "column_heights").data, p = a.dwg_ptr_to_double_array(g, M); return { type: "MTEXT", ...e, insertionPoint: _, textHeight: o, rectHeight: i, rectWidth: s, extentsHeight: l, extentsWidth: r, attachmentPoint: d, drawingDirection: I, text: c, styleName: E, extrusionDirection: C, direction: A, rotation: 0, // TODO: Didn't find the corresponding field in libredwg lineSpacingStyle: u, lineSpacing: T, backgroundFill: h, // backgroundColor: backgroundColor.rgb, // TODO: Double check whether it should be color index fillBoxScale: Y, backgroundFillColor: R.rgb, // TODO: Double check whether it should be color index backgroundFillTransparency: f, columnType: v, // columnCount: columnCount, columnFlowReversed: G, columnAutoHeight: S, columnWidth: y, columnGutter: x, columnHeightCount: M, columnHeights: p }; } convertPoint(t, e) { const a = this.libredwg, _ = a.dwg_dynapi_entity_value(t, "x").data, o = a.dwg_dynapi_entity_value(t, "y").data, i = a.dwg_dynapi_entity_value(t, "z").data, s = a.dwg_dynapi_entity_value(t, "thickness").data, r = a.dwg_dynapi_entity_value(t, "extrusion").data, l = a.dwg_dynapi_entity_value(t, "x_ang").data; return { type: "POINT", ...e, position: { x: _, y: o, z: i }, thickness: s, extrusionDirection: r, angle: l }; } convertPolyline2d(t, e, a) { const _ = this.libredwg, o = _.dwg_dynapi_entity_value(t, "flag").data, i = _.dwg_dynapi_entity_value(t, "curve_type").data, s = _.dwg_dynapi_entity_value(t, "start_width").data, r = _.dwg_dynapi_entity_value(t, "end_width").data, l = _.dwg_dynapi_entity_value(t, "elevation").data, d = _.dwg_dynapi_entity_value(t, "thickness").data, I = _.dwg_dynapi_entity_value(t, "extrusion").data, c = _.dwg_entity_polyline_2d_get_vertices(a); return { type: "POLYLINE2D", ...e, flag: o, smoothType: i, startWidth: s, endWidth: r, elevation: l, thickness: d, extrusionDirection: I, vertices: c.map((E) => ({ x: E.point.x, y: E.point.y, z: E.point.z, startWidth: E.start_width, endWidth: E.end_width, bulge: E.bulge, flag: E.flag, tangentDirection: E.tangent_dir })), meshMVertexCount: 0, meshNVertexCount: 0, surfaceMDensity: 0, surfaceNDensity: 0 }; } convertPolyline3d(t, e, a) { const _ = this.libredwg, o = _.dwg_dynapi_entity_value(t, "flag").data, i = _.dwg_dynapi_entity_value(t, "curve_type").data, s = _.dwg_dynapi_entity_value(t, "start_width").data, r = _.dwg_dynapi_entity_value(t, "end_width").data, l = _.dwg_dynapi_entity_value(t, "extrusion").data, d = _.dwg_entity_polyline_3d_get_vertices(a); return { type: "POLYLINE3D", ...e, flag: o, smoothType: i, startWidth: s, endWidth: r, extrusionDirection: l, vertices: d.map((I) => ({ x: I.point.x, y: I.point.y, z: I.point.z, flag: I.flag })) }; } convertProxy(t, e) { const _ = this.libredwg.dwg_dynapi_entity_value(t, "class_id").data; return { type: "PROXY", ...e, applicationEntityClassId: _ }; } convertRay(t, e) { const a = this.libredwg, _ = a.dwg_dynapi_entity_value(t, "point").data, o = a.dwg_dynapi_entity_value(t, "vector").data; return { type: "RAY", ...e, firstPoint: _, unitDirection: o }; } convertSection(t, e) { const a = this.libredwg, _ = a.dwg_dynapi_entity_value(t, "state").data, o = a.dwg_dynapi_entity_value(t, "flag").data, i = a.dwg_dynapi_entity_value(t, "name").data, s = a.dwg_dynapi_entity_value(t, "vert_dir").data, r = a.dwg_dynapi_entity_value(t, "top_height").data, l = a.dwg_dynapi_entity_value(t, "bottom_height").data, d = a.dwg_dynapi_entity_value(t, "indicator_alpha").data, I = a.dwg_dynapi_entity_value(t, "indicator_color").data, c = a.dwg_dynapi_entity_value(t, "num_verts").data, E = a.dwg_dynapi_entity_value(t, "verts").data, C = c > 0 ? a.dwg_ptr_to_point3d_array(E, c) : [], A = a.dwg_dynapi_entity_value(t, "num_blverts").data, u = a.dwg_dynapi_entity_value(t, "blverts").data, T = A > 0 ? a.dwg_ptr_to_point3d_array(u, A) : [], h = a.dwg_dynapi_entity_value(t, "geometrySettingHardId").data, Y = a.dwg_ref_get_handle_absolute_ref(h); return { type: "SECTION", ...e, state: _, flags: o, name: i, verticalDirection: s, topHeight: r, bottomHeight: l, indicatorTransparency: d, indicatorColor: I.rgb, numberOfVertices: c, vertices: C, numberOfBackLineVertices: A, backLineVertices: T, geometrySettingHardId: Y }; } convertSolid(t, e) { const a = this.libredwg, _ = a.dwg_dynapi_entity_value(t, "corner1").data, o = a.dwg_dynapi_entity_value(t, "corner2").data, i = a.dwg_dynapi_entity_value(t, "corner3").data, s = a.dwg_dynapi_entity_value(t, "corner4").data, r = a.dwg_dynapi_entity_value(t, "thickness").data, l = a.dwg_dynapi_entity_value(t, "extrusion").data; return { type: "SOLID", ...e, corner1: _, corner2: o, corner3: i, corner4: s, thickness: r, extrusionDirection: l }; } convertSpline(t, e) { const a = this.libredwg, _ = a.dwg_dynapi_entity_value(t, "splineflags").data, o = a.dwg_dynapi_entity_value(t, "degree").data, i = a.dwg_dynapi_entity_value(t, "knot_tol").data, s = a.dwg_dynapi_entity_value(t, "num_knots").data, r = a.dwg_dynapi_entity_value(t, "knots").data, l = a.dwg_ptr_to_double_array(r, s), d = a.dwg_dynapi_entity_value(t, "fit_tol").data, I = a.dwg_dynapi_entity_value(t, "num_fit_pts").data, c = a.dwg_dynapi_entity_value(t, "fit_pts").data, E = a.dwg_ptr_to_point3d_array(c, I), C = a.dwg_dynapi_entity_value(t, "weighted").data, A = a.dwg_dynapi_entity_value(t, "ctrl_tol").data, u = a.dwg_dynapi_entity_value(t, "num_ctrl_pts").data, T = a.dwg_dynapi_entity_value(t, "ctrl_pts").data, h = a.dwg_ptr_to_point4d_array(T, u), Y = a.dwg_dynapi_entity_value(t, "beg_tan_vec").data, R = a.dwg_dynapi_entity_value(t, "end_tan_vec").data; return { type: "SPLINE", ...e, // normal?: DwgPoint3D flag: _, degree: o, numberOfKnots: s, numberOfControlPoints: u, numberOfFitPoints: I, knotTolerance: i, controlTolerance: A, fitTolerance: d, startTangent: Y, endTangent: R, knots: l, weights: C ? h.map((f) => f.w) : void 0, controlPoints: h.map((f) => ({ x: f.x, y: f.y, z: f.z })), fitPoints: E }; } convertTable(t, e) { const a = this.libredwg, _ = a.dwg_dynapi_subclass_value(t, "ldata", "name").data, o = a.dwg_dynapi_entity_value(t, "ins_pt").data, i = a.dwg_dynapi_entity_value(t, "horiz_direction").data, s = a.dwg_dynapi_entity_value(t, "flag_for_table_value").data, r = a.dwg_dynapi_entity_value(t, "num_rows").data, l = a.dwg_dynapi_entity_value(t, "num_cols").data, d = a.dwg_dynapi_entity_value(t, "row_heights").data, I = a.dwg_ptr_to_double_array(d, r), c = a.dwg_dynapi_entity_value(t, "col_widths").data, E = a.dwg_ptr_to_double_array(c, l), C = a.dwg_dynapi_entity_value(t, "tablestyle").data, A = L(a.dwg_ref_get_absref(C)), u = a.dwg_dynapi_entity_value(t, "block_header").data, T = L(a.dwg_ref_get_absref(u)), h = a.dwg_dynapi_entity_value(t, "table_flag_override").data, Y = a.dwg_dynapi_entity_value(t, "border_color_overrides_flag").data, R = a.dwg_dynapi_entity_value(t, "border_lineweight_overrides_flag").data, f = a.dwg_dynapi_entity_value(t, "border_visibility_overrides_flag").data, v = a.dwg_dynapi_entity_value(t, "num_cells").data, G = a.dwg_dynapi_entity_value(t, "cells").data, S = a.dwg_ptr_to_table_cell_array(G, v); return { type: "ACAD_TABLE", ...e, name: _, startPoint: o, directionVector: i, // attachmentPoint: DwgAttachmentPoint tableValue: s, rowCount: r, columnCount: l, overrideFlag: h, borderColorOverrideFlag: Y, borderLineWeightOverrideFlag: R, borderVisibilityOverrideFlag: f, rowHeightArr: I, columnWidthArr: E, tableStyleId: A, blockRecordHandle: T, cells: this.convertTableCells(S), bmpPreview: "" }; } convertTableCells(t) { const e = []; return t.forEach((a) => ({ text: a.text_value, attachmentPoint: a.cell_alignment, textStyle: a.text_style, // TODO: Set the text style name instead of handle rotation: a.rotation, cellType: a.type, flagValue: a.flags, mergedValue: a.is_merged_value, autoFit: a.is_autofit_flag, // borderWidth?: number // borderHeight?: number topBorderVisibility: a.top_visibility, bottomBorderVisibility: a.bottom_visibility, leftBorderVisibility: a.left_visibility, rightBorderVisibility: a.right_visibility, overrideFlag: a.cell_flag_override, virtualEdgeFlag: a.virtual_edge_flag, // fieldObjetId?: string blockTableRecordI: a.block_handle.absolute_ref, blockScale: a.block_scale, blockAttrNum: a.attr_defs.length, attrDefineId: a.attr_defs.map((_) => _.attdef.absolute_ref), // attrText?: string // textHeight: number extendedCellFlags: a.additional_data_flag })), e; } convertTextBase(t) { const e = this.libredwg, a = e.dwg_dynapi_entity_value(t, "text_value").data, _ = e.dwg_dynapi_entity_value(t, "thickness").data, o = e.dwg_dynapi_entity_value(t, "ins_pt").data, i = e.dwg_dynapi_entity_value(t, "alignment_pt").data, s = e.dwg_dynapi_entity_value(t, "rotation").data, r = e.dwg_dynapi_entity_value(t, "height").data, l = e.dwg_dynapi_entity_value(t, "width_factor").data, d = e.dwg_dynapi_entity_value(t, "oblique_angle").data, I = e.dwg_entity_text_get_style_name(t), c = e.dwg_dynapi_entity_value(t, "generation").data, E = e.dwg_dynapi_entity_value(t, "horiz_alignment").data, C = e.dwg_dynapi_entity_value(t, "vert_alignment").data, A = e.dwg_dynapi_entity_value(t, "extrusion").data; return { text: a, thickness: _, startPoint: o, endPoint: i, textHeight: r, rotation: s, xScale: l, obliqueAngle: d, styleName: I, generationFlag: c, halign: E, valign: C, extrusionDirection: A }; } convertText(t, e) { return { type: "TEXT", ...e, ...this.convertTextBase(t) }; } convertTolerance(t, e) { const a = this.libredwg, _ = a.dwg_dynapi_entity_value(t, "ins_pt").data, o = a.dwg_dynapi_entity_value(t, "text_value").data, i = a.dwg_dynapi_entity_value(t, "x_direction").data, s = a.dwg_dynapi_entity_value(t, "extrusion").data, r = a.dwg_entity_get_dimstyle_name(t); return { type: "TOLERANCE", ...e, styleName: r, insertionPoint: _, text: o, extrusionDirection: s, xAxisDirection: i }; } convertViewport(t, e) { const a = this.libredwg, _ = a.dwg_dynapi_entity_value(t, "center").data, o = a.dwg_dynapi_entity_value(t, "width").data, i = a.dwg_dynapi_entity_value(t, "height").data, s = a.dwg_dynapi_entity_value(t, "on_off").data, r = a.dwg_dynapi_entity_value(t, "VIEWCTR").data, l = a.dwg_dynapi_entity_value(t, "SNAPBASE").data, d = a.dwg_dynapi_entity_value(t, "SNAPUNIT").data, I = a.dwg_dynapi_entity_value(t, "GRIDUNIT").data, c = a.dwg_dynapi_entity_value(t, "VIEWDIR").data, E = a.dwg_dynapi_entity_value(t, "view_target").data, C = a.dwg_dynapi_entity_value(t, "lens_length").data, A = a.dwg_dynapi_entity_value(t, "front_clip_z").data, u = a.dwg_dynapi_entity_value(t, "back_clip_z").data, T = a.dwg_dynapi_entity_value(t, "VIEWSIZE").data, h = a.dwg_dynapi_entity_value(t, "SNAPANG").data, Y = a.dwg_dynapi_entity_value(t, "twist_angle").data, R = a.dwg_dynapi_entity_value(t, "circle_zoom").data, f = a.dwg_dynapi_entity_value(t, "status_flag").data, v = a.dwg_dynapi_entity_value(t, "style_sheet").data, G = a.dwg_dynapi_entity_value(t, "render_mode").data, S = a.dwg_dynapi_entity_value(t, "UCSVP").data, y = a.dwg_dynapi_entity_value(t, "ucsorg").data, x = a.dwg_dynapi_entity_value(t, "ucsxdir").data, M = a.dwg_dynapi_entity_value(t, "ucsydir").data, g = a.dwg_dynapi_entity_value(t, "named_ucs").data, p = a.dwg_ref_get_absref(g), O = a.dwg_dynapi_entity_value(t, "base_ucs").data, b = a.dwg_ref_get_absref(O), k = a.dwg_dynapi_entity_value(t, "UCSORTHOVIEW").data, X = a.dwg_dynapi_entity_value(t, "ucs_elevation").data, H = a.dwg_dynapi_entity_value(t, "shadeplot_mode").data, w = a.dwg_dynapi_entity_value(t, "use_default_lights").data, K = a.dwg_dynapi_entity_value(t, "default_lighting_type").data, B = a.dwg_dynapi_entity_value(t, "brightness").data, V = a.dwg_dynapi_entity_value(t, "contrast").data, nt = a.dwg_dynapi_entity_value(t, "grid_major").data, at = a.dwg_dynapi_entity_value(t, "background").data, et = a.dwg_ref_get_absref(at), _t = a.dwg_dynapi_entity_value(t, "shadeplot").data, it = a.dwg_ref_get_absref(_t), ot = a.dwg_dynapi_entity_value(t, "visualstyle").data, st = a.dwg_ref_get_absref(ot), rt = a.dwg_dynapi_entity_value(t, "sun").data, dt = a.dwg_ref_get_absref(rt); return { type: "VIEWPORT", ...e, viewportCenter: _, width: o, height: i, status: s, viewportId: 0, // Will be set later in LibreDwgConverter.convert displayCenter: r, snapBase: l, snapSpacing: d, gridSpacing: I, viewDirection: c, targetPoint: E, perspectiveLensLength: C, frontClipZ: A, backClipZ: u, viewHeight: T, snapAngle: h, viewTwistAngle: Y, circleZoomPercent: R, statusBitFlags: f, sheetName: v, renderMode: G, ucsPerViewport: S, ucsOrigin: y, ucsXAxis: x, ucsYAxis: M, ucsId: L(p), ucsBaseId: L(b), orthographicType: k, elevation: X, shadePlotMode: H, majorGridFrequency: nt, backgroundId: L(et), shadePlotId: L(it), visualStyleId: L(st), isDefaultLighting: !!w, defaultLightingType: K, brightness: B, contrast: V, sunId: L(dt) }; } convertWipeout(t, e) { const a = this.libredwg, _ = a.dwg_dynapi_entity_value(t, "class_version").data, o = a.dwg_dynapi_entity_value(t, "pt0").data, i = a.dwg_dynapi_entity_value(t, "uvec").data, s = a.dwg_dynapi_entity_value(t, "vvec").data, r = a.dwg_dynapi_entity_value(t, "image_size").data, l = a.dwg_dynapi_entity_value(t, "display_props").data, d = a.dwg_dynapi_entity_value(t, "clipping").data, I = a.dwg_dynapi_entity_value(t, "brightness").data, c = a.dwg_dynapi_entity_value(t, "contrast").data, E = a.dwg_dynapi_entity_value(t, "fade").data, C = a.dwg_dynapi_entity_value(t, "clip_mode").data, A = a.dwg_dynapi_entity_value(t, "clip_boundary_type").data, u = a.dwg_dynapi_entity_value(t, "num_clip_verts").data, T = a.dwg_dynapi_entity_value(t, "clip_verts").data, h = a.dwg_ptr_to_point2d_array(T, u), Y = a.dwg_dynapi_entity_value(t, "imagedef").data, R = a.dwg_ref_get_absref(Y), f = a.dwg_dynapi_entity_value(t, "imagedefreactor").data, v = a.dwg_ref_get_absref(f); return { type: "WIPEOUT", ...e, version: _, position: o, uPixel: i, vPixel: s, imageSize: r, imageDefHandle: R, flags: l, clipping: d, brightness: I, contrast: c, fade: E, imageDefReactorHandle: v, clippingBoundaryType: A, countBoundaryPoints: u, clippingBoundaryPath: h, clipMode: C }; } convertXline(t, e) { const a = this.libredwg, _ = a.dwg_dynapi_entity_value(t, "point").data, o = a.dwg_dynapi_entity_value(t, "vector").data; return { type: "XLINE", ...e, firstPoint: _, unitDirection: o }; } getDimensionCommonAttrs(t) { const e = this.libredwg, a = e.dwg_dynapi_entity_value(t, "class_version").data, _ = e.dwg_entity_get_block_name(t, "block"), o = e.dwg_dynapi_entity_value(t, "def_pt").data, i = e.dwg_dynapi_entity_value(t, "text_midpt").data, s = e.dwg_dynapi_entity_value(t, "attachmentPoint").data, r = e.dwg_dynapi_entity_value(t, "flag").data, l = e.dwg_dynapi_entity_value(t, "lspace_factor").data, d = e.dwg_dynapi_entity_value(t, "lspace_factor").data, I = e.dwg_dynapi_entity_value(t, "act_measurement").data, c = e.dwg_dynapi_entity_value(t, "user_text").data, E = e.dwg_dynapi_entity_value(t, "text_rotation").data, C = e.dwg_dynapi_entity_value(t, "ins_rotation").data, A = e.dwg_dynapi_entity_value(t, "extrusion").data, u = e.dwg_entity_get_dimstyle_name(t); return { type: "DIMENSION", version: a, name: _, definitionPoint: o, textPoint: i, dimensionType: r, attachmentPoint: s, textLineSpacingStyle: l, textLineSpacingFactor: d || 1, measurement: I, text: c, textRotation: E, ocsRotation: C, extrusionDirection: A, styleName: u }; } getCommonAttrs(t) { const e = this.libredwg, a = e.dwg_object_entity_get_color_object(t), _ = a.method, o = a.index; let i; (_ == 194 || (a.rgb >>> 24 & 255) === 194) && (i = a.rgb & 16777215); const s = this.getLayerName(t), r = e.dwg_object_entity_get_handle_object(t), l = e.dwg_object_entity_get_ownerhandle_object(t), d = e.dwg_object_entity_get_xdicobjhandle_object(t), I = this.getLtypeName(t), c = e.dwg_object_entity_get_line_weight(t), E = e.dwg_object_entity_get_ltype_scale(t), C = !e.dwg_object_entity_get_invisible(t), A = e.dwg_object_entity_get_xdata(t); return { handle: L(r.value), ownerDictionaryHardId: L(d.absolute_ref), ownerBlockRecordSoftId: L(l.absolute_ref), layer: s, color: i, colorIndex: o, colorName: a.name, lineType: I, lineweight: c, lineTypeScale: E, isVisible: C, transparency: a.alpha, transparencyType: a.alpha_type, xdata: A }; } getLayerName(t) { const a = this.libredwg.dwg_object_entity_get_layer_object_ref(t); return this.layers.get(L(a.handleref.value)) ?? "0"; } getLtypeName(t) { const a = this.libredwg.dwg_object_entity_get_ltype_object_ref(t); return this.ltypes.get(L(a.handleref.value)) ?? ""; } } class mt { constructor(t) { N(this, "libredwg"); N(this, "entityConverter"); this.libredwg = t, this.entityConverter = new pn(t); } convert(t) { this.entityConverter.clear(); const e = { tables: { APPID: { entries: [] }, BLOCK_RECORD: { entries: [] }, DIMSTYLE: { entries: [] }, LAYER: { entries: [] }, LTYPE: { entries: [] }, STYLE: { entries: [] }, VPORT: { entries: [] } }, objects: { DICTIONARY: [], IMAGEDEF: [], LAYOUT: [], SPATIAL_FILTER: [] }, header: {}, entities: [], classes: [] }, a = this.libredwg; this.convertHeader(t, e.header), this.convertClasses(t, e.classes); const _ = a.dwg_get_num_objects(t); for (let i = 0; i < _; i++) { const s = a.dwg_get_object(t, i); if (s) { const r = a.dwg_object_to_object_tio(s); if (r) switch (a.dwg_object_get_fixedtype(s)) { case P.DWG_TYPE_LAYER: { const d = this.convertLayer(r, s); e.tables.LAYER.entries.push(d), this.entityConverter.layers.set(d.handle, d.name); } break; case P.DWG_TYPE_LTYPE: { const d = this.convertLineType(r, s); e.tables.LTYPE.entries.push(d), this.entityConverter.ltypes.set(d.handle, d.name); } break; } } } for (let i = 0; i < _; i++) { const s = a.dwg_get_object(t, i); if (s) { const r = a.dwg_object_to_object_tio(s); if (r) switch (a.dwg_object_get_fixedtype(s)) { case P.DWG_TYPE_APPID: e.tables.APPID.entries.push(this.convertAppId(r)); break; case P.DWG_TYPE_BLOCK_HEADER: { const d = this.convertBlockRecord(r, s); e.tables.BLOCK_RECORD.entries.push(d), (Bt(d.name) || xn(d.name)) && d.entities.forEach((I) => { e.entities.push(I), I.type === "INSERT" && I.attribs.forEach((c) => { e.entities.push(c); }); }); } break; case P.DWG_TYPE_DIMSTYLE: e.tables.DIMSTYLE.entries.push(this.convertDimStyle(r, s)); break; case P.DWG_TYPE_STYLE: e.tables.STYLE.entries.push(this.convertStyle(r, s)); break; case P.DWG_TYPE_VPORT: e.tables.VPORT.entries.push(this.convertViewport(r, s)); break; case P.DWG_TYPE_DICTIONARY: e.objects.DICTIONARY.push(this.convertDictionary(r, s)); break; case P.DWG_TYPE_IMAGEDEF: e.objects.IMAGEDEF.push(this.convertImageDef(r, s)); break; case P.DWG_TYPE_LAYOUT: e.objects.LAYOUT.push(this.convertLayout(r, s)); break; case P.DWG_TYPE_SPATIAL_FILTER: e.objects.SPATIAL_FILTER.push(this.convertSpatialFilter(r, s)); break; } } } const o = e.entities.filter((i) => i.type === "VIEWPORT"); return o.sort((i, s) => { const r = parseInt(i.handle, 16), l = parseInt(s.handle, 16); return r - l; }), o.forEach((i, s) => { i.viewportId = s + 1; }), e; } getConversionStats() { return { unknownEntityCount: this.entityConverter.unknownEntityCount }; } convertHeader(t, e) { const a = this.libredwg; Dn.forEach((_) => { let o = _; (_ == "DIMBLK" || _ == "DIMBLK1" || _ == "DIMBLK2") && (o = o + "_T"); let i = a.dwg_dynapi_header_value(t, o).data; _ == "CELTYPE" || _ == "CLAYER" || _ == "CLAYER" || _ == "DIMSTYLE" || _ == "DIMTXSTY" || _ == "TEXTSTYLE" ? i = i ? a.dwg_ref_get_object_name(i) : "" : _ == "DRAGVS" && (i = i ? a.dwg_ref_get_absref(i) : 2), e[_] = i; }); } convertClasses(t, e) { const a = this.libredwg, _ = a.dwg_get_num_classes(t); for (let o = 0; o < _; o++) { const i = a.dwg_get_class(t, o); e.push({ dxfName: i.dxfname, cppName: i.cppname, appName: i.appname, capabilitiesFlag: i.proxyflag, instanceCount: i.num_instances, wasAProxyFlag: i.s_zombie, // DWG_TYPE_PROXY_ENTITY = 0x1F2 /* 498 */, // DWG_TYPE_PROXY_OBJECT = 0x1F3 /* 499 */, isAnEntityFlag: i.item_class_id === 498 }); } } convertAppId(t) { const e = this.libredwg, a = e.dwg_dynapi_entity_value(t, "name").data, _ = e.dwg_dynapi_entity_value(t, "flag").data; return { name: a, standardFlag: _ }; } convertBlockRecord(t, e) { const a = this.libredwg, _ = this.getCommonTableEntryAttrs(t, e), o = a.dwg_entity_block_header_get_block(t); o.name && (_.name = o.name); const i = a.dwg_dynapi_entity_value(t, "num_owned").data, s = a.dwg_dynapi_entity_value(t, "flag").data, r = a.dwg_dynapi_entity_value(t, "description").data, l = a.dwg_dynapi_entity_value(t, "base_pt").data, d = a.dwg_dynapi_entity_value(t, "insert_units").data, I = a.dwg_dynapi_entity_value(t, "explodable").data, c = a.dwg_dynapi_entity_value(t, "block_scaling").data, E = a.dwg_dynapi_entity_value(t, "layout").data, C = L(a.dwg_ref_get_absref(E)); let A = ""; const u = (Y) => { const R = new Array(Y.length); for (let f = 0; f < Y.length; f++) R[f] = Y[f].toString(16).toUpperCase(); return R.join(""); }, T = a.dwg_entity_block_header_get_preview(t); T && T.length > 0 && (A = u(T)); let h = this.convertEntities(e, _.handle); if (!h || h.length == 0) { h = []; const Y = a.dwg_dynapi_entity_value(t, "entities").data; if (Y) { const R = a.dwg_ptr_to_object_ref_ptr_array(Y, i), f = this.entityConverter; for (let v = 0; v < i; v++) { const G = a.dwg_ref_get_object(R[v]), S = f.convert(G); S && (S.ownerBlockRecordSoftId = _.handle, h.push(S)); } } } return { ..._, flags: s, description: r, basePoint: l, layout: C, insertionUnits: d, explodability: I, scalability: c, bmpPreview: A, entities: h }; } convertEntities(t, e) { const a = this.libredwg, _ = this.entityConverter, o = []; let i = a.get_first_owned_entity(t); for (; i; ) { const s = _.convert(i); s && (s.ownerBlockRecordSoftId = e, o.push(s)), i = a.get_next_owned_entity(t, i); } return o; } convertDimStyle(t, e) { const a = this.libredwg, _ = this.getCommonTableEntryAttrs(t, e), o = a.dwg_dynapi_entity_value(t, "DIMTOL").data, i = a.dwg_dynapi_entity_value(t, "DIMLIM").data, s = a.dwg_dynapi_entity_value(t, "DIMTIH").data, r = a.dwg_dynapi_entity_value(t, "DIMTOH").data, l = a.dwg_dynapi_entity_value(t, "DIMSE1").data, d = a.dwg_dynapi_entity_value(t, "DIMSE2").data, I = a.dwg_dynapi_entity_value(t, "DIMALT").data, c = a.dwg_dynapi_entity_value(t, "DIMTOFL").data, E = a.dwg_dynapi_entity_value(t, "DIMSAH").data, C = a.dwg_dynapi_entity_value(t, "DIMTIX").data, A = a.dwg_dynapi_entity_value(t, "DIMSOXD").data, u = a.dwg_dynapi_entity_value(t, "DIMALTD").data, T = a.dwg_dynapi_entity_value(t, "DIMZIN").data, h = a.dwg_dynapi_entity_value(t, "DIMSD1").data, Y = a.dwg_dynapi_entity_value(t, "DIMSD2").data, R = a.dwg_dynapi_entity_value(t, "DIMTOLJ").data, f = a.dwg_dynapi_entity_value(t, "DIMJUST").data, v = a.dwg_dynapi_entity_value(t, "DIMFIT").data, G = a.dwg_dynapi_entity_value(t, "DIMUPT").data, S = a.dwg_dynapi_entity_value(t, "DIMTZIN").data, y = a.dwg_dynapi_entity_value(t, "DIMALTZ").data, x = a.dwg_dynapi_entity_value(t, "DIMALTTZ").data, M = a.dwg_dynapi_entity_value(t, "DIMTAD").data, g = a.dwg_dynapi_entity_value(t, "DIMUNIT").data, p = a.dwg_dynapi_entity_value(t, "DIMAUNIT").data, O = a.dwg_dynapi_entity_value(t, "DIMDEC").data, b = a.dwg_dynapi_entity_value(t, "DIMTDEC").data, k = a.dwg_dynapi_entity_value(t, "DIMALTU").data, X = a.dwg_dynapi_entity_value(t, "DIMALTTD").data, H = a.dwg_dynapi_entity_value(t, "DIMSCALE").data, w = a.dwg_dynapi_entity_value(t, "DIMASZ").data, K = a.dwg_dynapi_entity_value(t, "DIMEXO").data, B = a.dwg_dynapi_entity_value(t, "DIMDLI").data, V = a.dwg_dynapi_entity_value(t, "DIMEXE").data, nt = a.dwg_dynapi_entity_value(t, "DIMRND").data, at = a.dwg_dynapi_entity_value(t, "DIMDLE").data, et = a.dwg_dynapi_entity_value(t, "DIMTP").data, _t = a.dwg_dynapi_entity_value(t, "DIMTM").data, it = a.dwg_dynapi_entity_value(t, "DIMFXL").data, ot = a.dwg_dynapi_entity_value(t, "DIMJOGANG").data, st = a.dwg_dynapi_entity_value(t, "DIMTFILL").data, rt = a.dwg_dynapi_entity_value(t, "DIMTFILLCLR").data, dt = a.dwg_dynapi_entity_value(t, "DIMAZIN").data, Ft = a.dwg_dynapi_entity_value(t, "DIMARCSYM").data, Ut = a.dwg_dynapi_entity_value(t, "DIMTXT").data, bt = a.dwg_dynapi_entity_value(t, "DIMCEN").data, kt = a.dwg_dynapi_entity_value(t, "DIMTSZ").data, Xt = a.dwg_dynapi_entity_value(t, "DIMALTF").data, Ht = a.dwg_dynapi_entity_value(t, "DIMLFAC").data, Kt = a.dwg_dynapi_entity_value(t, "DIMTVP").data, Vt = a.dwg_dynapi_entity_value(t, "DIMTFAC").data, $t = a.dwg_dynapi_entity_value(t, "DIMGAP").data, Jt = a.dwg_dynapi_entity_value(t, "DIMPOST").data, zt = a.dwg_dynapi_entity_value(t, "DIMAPOST").data, Zt = a.dwg_dynapi_entity_value(t, "DIMBLK_T").data, qt = a.dwg_dynapi_entity_value(t, "DIMBLK1_T").data, Qt = a.dwg_dynapi_entity_value(t, "DIMBLK2_T").data, jt = a.dwg_dynapi_entity_value(t, "DIMALTRND").data, tn = a.dwg_dynapi_entity_value(t, "DIMCLRD_N").data, nn = a.dwg_dynapi_entity_value(t, "DIMCLRE_N").data, an = a.dwg_dynapi_entity_value(t, "DIMCLRT_N").data, en = a.dwg_dynapi_entity_value(t, "DIMCLRD").data, _n = a.dwg_dynapi_entity_value(t, "DIMCLRE").data, on = a.dwg_dynapi_entity_value(t, "DIMCLRT").data, sn = a.dwg_dynapi_entity_value(t, "DIMADEC").data, rn = a.dwg_dynapi_entity_value(t, "DIMFRAC").data, dn = a.dwg_dynapi_entity_value(t, "DIMLUNIT").data, ln = a.dwg_dynapi_entity_value(t, "DIMDSEP").data, En = a.dwg_dynapi_entity_value(t, "DIMTMOVE").data, cn = a.dwg_dynapi_entity_value(t, "DIMATFIT").data, un = a.dwg_dynapi_entity_value(t, "DIMFXLON").data, In = a.dwg_dynapi_entity_value(t, "DIMTXTDIRECTION").data, An = a.dwg_dynapi_entity_value(t, "DIMALTMZF").data, Pn = a.dwg_dynapi_entity_value(t, "DIMALTMZS").data, Tn = a.dwg_dynapi_entity_value(t, "DIMMZF").data, Cn = a.dwg_dynapi_entity_value(t, "DIMMZS").data, hn = a.dwg_dynapi_entity_value(t, "DIMLWD").data, Yn = a.dwg_dynapi_entity_value(t, "DIMLWE").data, Rn = a.dwg_dynapi_entity_value(t, "DIMTXSTY").data, fn = a.dwg_ref_get_absref(Rn), vn = a.dwg_dynapi_entity_value(t, "DIMLDRBLK").data, Ln = a.dwg_ref_get_absref(vn); return { ..._, DIMPOST: Jt, DIMAPOST: zt, DIMBLK: Zt, DIMBLK1: qt, DIMBLK2: Qt, DIMSCALE: H, DIMASZ: w, DIMEXO: K, DIMDLI: B, DIMEXE: V, DIMRND: nt, DIMDLE: at, DIMTP: et, DIMTM: _t, DIMTXT: Ut, DIMCEN: bt, DIMTSZ: kt, DIMALTF: Xt, DIMLFAC: Ht, DIMTVP: Kt, DIMTFAC: Vt, DIMGAP: $t, DIMALTRND: jt, DIMTOL: o, DIMLIM: i, DIMTIH: s, DIMTOH: r, DIMSE1: l, DIMSE2: d, DIMTAD: M, DIMZIN: T, DIMAZIN: dt, DIMALT: I, DIMALTD: u, DIMTOFL: c, DIMSAH: E, DIMTIX: C, DIMSOXD: A, DIMCLRD: en, DIMCLRE: _n, DIMCLRT: on, DIMADEC: sn, DIMUNIT: g, DIMDEC: O, DIMTDEC: b, DIMALTU: k, DIMALTTD: X, DIMAUNIT: p, DIMFRAC: rn, DIMLUNIT: dn, DIMDSEP: String.fromCharCode(ln), DIMTMOVE: En, DIMJUST: f, DIMSD1: h, DIMSD2: Y, DIMTOLJ: R, DIMTZIN: S, DIMALTZ: y, DIMALTTZ: x, DIMFIT: v, DIMUPT: G, DIMATFIT: cn, DIMTXSTY: fn, DIMLDRBLK: Ln, DIMLWD: hn, DIMLWE: Yn, DIMFXL: it, DIMJOGANG: ot, DIMTFILL: st, DIMTFILLCLR: rt, DIMARCSYM: Ft, DIMCLRD_N: tn, DIMCLRE_N: nn, DIMCLRT_N: an, DIMFXLON: un, DIMTXTDIRECTION: In, DIMALTMZF: An, DIMALTMZS: Pn, DIMMZF: Tn, DIMMZS: Cn }; } convertLayer(t, e) { const a = this.libredwg, _ = this.getCommonTableEntryAttrs(t, e), o = a.dwg_dynapi_entity_value(t, "flag").data, i = a.dwg_dynapi_entity_value(t, "frozen").data, s = a.dwg_dynapi_entity_value(t, "off").data, r = a.dwg_dynapi_entity_value(t, "frozen_in_new").data, l = a.dwg_dynapi_entity_value(t, "plotflockedlag").data, d = a.dwg_dynapi_entity_value(t, "plotflag").data, I = a.dwg_dynapi_entity_value(t, "linewt").data, c = a.dwg_dynapi_entity_value(t, "color").data, E = a.dwg_dynapi_entity_value(t, "ltype").data; let C = "Continuous"; if (E) try { C = a.dwg_ref_get_object_name(E); } catch { } const A = c.method; let u = 256, T = 16777215; return A === 195 || (c.rgb >>> 24 & 255) === 195 ? u = c.rgb & 255 : A == 194 || (c.rgb >>> 24 & 255) === 194 ? T = c.rgb & 16777215 : c.index >= 1 && c.index <= 255 && (u = c.index), { ..._, standardFlag: o, colorIndex: u, color: T, colorName: c.name, transparency: c.alpha, lineType: C, frozen: i != 0, off: s != 0, frozenInNew: r != 0, locked: l != 0, plotFlag: d, lineweight: I, plotStyleNameObjectId: "", materialObjectId: "" }; } convertLineType(t, e) { const a = this.libredwg, _ = this.getCommonTableEntryAttrs(t, e), o = a.dwg_dynapi_entity_value(t, "flag").data, i = a.dwg_dynapi_entity_value(t, "description").data, s = a.dwg_dynapi_entity_value(t, "numdashes").data, r = a.dwg_dynapi_entity_value(t, "pattern_len").data, l = a.dwg_dynapi_entity_value(t, "dashes").data, d = l ? a.dwg_ptr_to_ltype_dash_array(l, s) : []; return { ..._, description: i, standardFlag: o, numberOfLineTypes: s, totalPatternLength: r, pattern: this.convertLineTypePattern(d) }; } convertLineTypePattern(t) { const e = []; return t.forEach((a) => { e.push({ elementLength: a.length || 0, elementTypeFlag: a.complex_shapecode, shapeNumber: a.shape_flag, // TODO: convert style handle to style object id // styleObjectId: dash.style, scale: a.scale, rotation: a.rotation, offsetX: a.x_offset, offsetY: a.y_offset, text: a.text }); }), e; } convertStyle(t, e) { const a = this.libredwg, _ = this.getCommonTableEntryAttrs(t, e), o = a.dwg_dynapi_entity_value(t, "flag").data, i = a.dwg_dynapi_entity_value(t, "width_factor").data, s = a.dwg_dynapi_entity_value(t, "oblique_angle").data, r = a.dwg_dynapi_entity_value(t, "generation").data, l = a.dwg_dynapi_entity_value(t, "last_height").data, d = a.dwg_dynapi_entity_value(t, "font_file").data, I = a.dwg_dynapi_entity_value(t, "bigfont_file").data; return { ..._, standardFlag: o, fixedTextHeight: 0, // TODO: Set the correct value widthFactor: i, obliqueAngle: s, textGenerationFlag: r, lastHeight: l, font: d, bigFont: I }; } convertViewport(t, e) { const a = this.libredwg, _ = this.getCommonTableEntryAttrs(t, e), o = a.dwg_dynapi_entity_value(t, "flag").data, i = a.dwg_dynapi_entity_value(t, "VIEWSIZE").data, s = a.dwg_dynapi_entity_value(t, "aspect_ratio").data, r = a.dwg_dynapi_entity_value(t, "VIEWCTR").data, l = a.dwg_dynapi_entity_value(t, "view_target").data, d = a.dwg_dynapi_entity_value(t, "VIEWDIR").data, I = a.dwg_dynapi_entity_value(t, "view_twist").data, c = a.dwg_dynapi_entity_value(t, "lens_length").data, E = a.dwg_dynapi_entity_value(t, "front_clip_z").data, C = a.dwg_dynapi_entity_value(t, "back_clip_z").data, A = a.dwg_dynapi_entity_value(t, "VIEWMODE").data, u = a.dwg_dynapi_entity_value(t, "render_mode").data, T = a.dwg_dynapi_entity_value(t, "use_default_lights").data != 0, h = a.dwg_dynapi_entity_value(t, "default_lightning_type").data, Y = a.dwg_dynapi_entity_value(t, "brightness").data, R = a.dwg_dynapi_entity_value(t, "contrast").data, f = a.dwg_dynapi_entity_value(t, "ambient_color").data, v = a.dwg_dynapi_entity_value(t, "lower_left").data, G = a.dwg_dynapi_entity_value(t, "upper_right").data, S = a.dwg_dynapi_entity_value(t, "circle_zoom").data, y = a.dwg_dynapi_entity_value(t, "UCSICON").data, x = a.dwg_dynapi_entity_value(t, "GRIDUNIT").data, M = a.dwg_dynapi_entity_value(t, "SNAPANG").data, g = a.dwg_dynapi_entity_value(t, "SNAPBASE").data, p = a.dwg_dynapi_entity_value(t, "SNAPUNIT").data, O = a.dwg_dynapi_entity_value(t, "ucsorg").data, b = a.dwg_dynapi_entity_value(t, "ucsxdir").data, k = a.dwg_dynapi_entity_value(t, "ucsydir").data, X = a.dwg_dynapi_entity_value(t, "ucs_elevation").data, H = a.dwg_dynapi_entity_value(t, "grid_major").data, w = a.dwg_dynapi_entity_value(t, "background").data, K = w ? L(a.dwg_ref_get_absref(w)) : void 0, B = a.dwg_dynapi_entity_value(t, "visualstyle").data, V = B ? L(a.dwg_ref_get_absref(B)) : void 0; return { ..._, standardFlag: o, lowerLeftCorner: v, upperRightCorner: G, center: r, snapBasePoint: g, snapSpacing: p, gridSpacing: x, viewDirectionFromTarget: d, viewTarget: l, lensLength: c, frontClippingPlane: E, backClippingPlane: C, viewHeight: i, aspectRatio: s, snapRotationAngle: M, viewTwistAngle: I, circleSides: S, frozenLayers: [], // TODO: Set the correct value styleSheet: "", // TODO: Set the correct value renderMode: u, viewMode: A, ucsIconSetting: y, ucsOrigin: O, ucsXAxis: b, ucsYAxis: k, orthographicType: 0, // TODO: Set the correct value elevation: X, shadePlotSetting: 0, // TODO: Set the correct value majorGridLines: H, backgroundObjectId: K, // shadePlotObjectId: undefined, visualStyleObjectId: V, isDefaultLightingOn: T, defaultLightingType: h, brightness: Y, contrast: R, // TODO: Not sure whether 'index' or 'rgb' should be used ambientColor: f.index }; } getCommonTableEntryAttrs(t, e) { const a = this.libredwg, _ = a.dwg_object_get_tio(e), o = a.dwg_object_object_get_ownerhandle_object(_), i = a.dwg_object_get_handle_object(e); return { handle: L(i.value), ownerHandle: L(o.absolute_ref), name: a.dwg_dynapi_entity_value(t, "name").data }; } convertDictionary(t, e) { const a = this.libredwg, _ = this.getCommonObjectAttrs(e), o = a.dwg_dynapi_entity_value(t, "is_hardowner").data, i = a.dwg_dynapi_entity_value(t, "cloning").data, s = a.dwg_dynapi_entity_value(t, "numitems").data, r = a.dwg_dynapi_entity_value(t, "itemhandles").data, l = a.dwg_ptr_to_object_ref_array(r, s), d = a.dwg_object_dictionary_get_texts(e), I = {}; return l.forEach((c, E) => I[d[E]] = L(c.absolute_ref)), { ..._, isHardOwner: !!o, cloningFlag: i, entries: I }; } convertImageDef(t, e) { const a = this.libredwg, _ = this.getCommonObjectAttrs(e), o = a.dwg_dynapi_entity_value(t, "image_size").data, i = a.dwg_dynapi_entity_value(t, "file_path").data, s = a.dwg_dynapi_entity_value(t, "is_loaded").data, r = a.dwg_dynapi_entity_value(t, "pixel_size").data, l = a.dwg_dynapi_entity_value(t, "resunits").data; return { ..._, fileName: i, size: o, sizeOfOnePixel: r, isLoaded: s, resolutionUnits: l }; } convertLayout(t, e) { const a = this.libredwg, _ = this.getCommonObjectAttrs(e), o = a.dwg_dynapi_entity_value(t, "layout_name").data, i = a.dwg_dynapi_entity_value(t, "tab_order").data, s = a.dwg_dynapi_entity_value(t, "layout_flags").data, r = a.dwg_dynapi_entity_value(t, "INSBASE").data, l = a.dwg_dynapi_entity_value(t, "LIMMIN").data, d = a.dwg_dynapi_entity_value(t, "LIMMAX").data, I = a.dwg_dynapi_entity_value(t, "UCSORG").data, c = a.dwg_dynapi_entity_value(t, "UCSXDIR").data, E = a.dwg_dynapi_entity_value(t, "UCSYDIR").data, C = a.dwg_dynapi_entity_value(t, "UCSORTHOVIEW").data, A = a.dwg_dynapi_entity_value(t, "EXTMIN").data, u = a.dwg_dynapi_entity_value(t, "EXTMAX").data, T = a.dwg_dynapi_entity_value(t, "ucs_elevation").data, h = a.dwg_dynapi_entity_value(t, "block_header").data, Y = L(a.dwg_ref_get_absref(h)), R = a.dwg_dynapi_entity_value(t, "active_viewport").data, f = L(a.dwg_ref_get_absref(R)), v = a.dwg_dynapi_entity_value(t, "named_ucs").data, G = v ? L(a.dwg_ref_get_absref(v)) : void 0; return { ..._, layoutName: o, controlFlag: s, tabOrder: i, minLimit: l, maxLimit: d, insertionPoint: r, minExtent: A, maxExtent: u, elevation: T, ucsOrigin: I, ucsXAxis: c, ucsYAxis: E, orthographicType: C, paperSpaceTableId: Y, viewportId: f, namedUcsId: G, // orthographicUcsId?: string; shadePlotId: "" // TODO: Set the correct value }; } convertSpatialFilter(t, e) { const a = this.libredwg, _ = this.getCommonObjectAttrs(e), o = a.dwg_dynapi_entity_value(t, "origin").data, i = a.dwg_dynapi_entity_value(t, "num_clip_verts").data, s = a.dwg_dynapi_entity_value(t, "clip_verts").data, r = a.dwg_ptr_to_point2d_array(s, i), l = a.dwg_dynapi_entity_value(t, "extrusion").data, d = a.dwg_dynapi_entity_value(t, "display_boundary_on").data, I = a.dwg_dynapi_entity_value(t, "front_clip_on").data, c = a.dwg_dynapi_entity_value(t, "front_clip_z").data, E = a.dwg_dynapi_entity_value(t, "back_clip_on").data, C = a.dwg_dynapi_entity_value(t, "back_clip_z").data, A = a.dwg_dynapi_entity_value(t, "transform").data, u = a.dwg_ptr_to_double_array(A, 12), T = a.dwg_dynapi_entity_value(t, "inverse_transform").data, h = a.dwg_ptr_to_double_array(T, 12); return { ..._, origin: o, numberOfPointsOnClipBoundary: i, vertices: r, extrusionDirection: l, clipBoundaryVisible: !!d, frontClippingPlaneFlag: !!I, frontClippingPlaneDistance: c, backClippingPlaneFlag: !!E, backClippingPlaneDistance: C, matrix: u, invertBlockMatrix: h }; } getCommonObjectAttrs(t) { const e = this.libredwg, a = e.dwg_object_get_tio(t), _ = e.dwg_object_object_get_ownerhandle_object(a), o = e.dwg_object_get_handle_object(t); return { handle: L(o.value), ownerHandle: L(_.absolute_ref) }; } } class D { constructor() { N(this, "min"); N(this, "max"); N(this, "valid"); this.min = { x: 1 / 0, y: 1 / 0 }, this.max = { x: -1 / 0, y: -1 / 0 }, this.valid = !1; } /** * Expands the bounding box to include a given point. * * @param point - The point to include in the bounding box. * @returns This bounding box after expansion. */ expandByPoint(t) { return this.min.x = Math.min(this.min.x, t.x), this.min.y = Math.min(this.min.y, t.y), this.max.x = Math.max(this.max.x, t.x), this.max.y = Math.max(this.max.y, t.y), this.valid = !0, this; } /** * Applies a scaling and translation transformation to this bounding box. * * @param scale - The scaling factors in x and y directions. * @param translation - The translation offsets in x and y directions. * @returns This bounding box after transformation. */ transform(t, e) { const a = this.getCorners().map((_) => ({ x: _.x * t.x + e.x, y: _.y * t.y + e.y })); this.reset(); for (const _ of a) this.expandByPoint(_); return this; } /** * Applies a rotation around a specific point to this bounding box. * * @param angleInRad - The angle of rotation in radians. * @param point - The center of rotation. * @returns This bounding box after rotation. */ rotate(t, e) { const a = Math.cos(t), _ = Math.sin(t), o = this.getCorners().map((i) => { const s = i.x - e.x, r = i.y - e.y; return { x: e.x + s * a - r * _, y: e.y + s * _ + r * a }; }); this.reset(); for (const i of o) this.expandByPoint(i); return this; } /** * Creates a deep copy of this bounding box. * * @returns A new instance of Box2D with the same properties. */ clone() { const t = new D(); return t.min = { x: this.min.x, y: this.min.y }, t.max = { x: this.max.x, y: this.max.y }, t.valid = this.valid, t; } /** * Resets this bounding box to its initial unbounded state. */ reset() { this.min = { x: 1 / 0, y: 1 / 0 }, this.max = { x: -1 / 0, y: -1 / 0 }, this.valid = !1; } /** * Retrieves the four corner points of the bounding box. * * @returns An array of corner points in the order: * bottom-left, top-left, bottom-right, top-right. */ getCorners() { return [ { x: this.min.x, y: this.min.y }, { x: this.min.x, y: this.max.y }, { x: this.max.x, y: this.min.y }, { x: this.max.x, y: this.max.y } ]; } } function mn(n, t, e, a, _) { const o = e.length; if (o === 0) throw new Error("points must not be empty"); const i = e[0].length; if (n < 0 || n > 1) throw new Error(`t out of bounds [0,1]: ${n}`); if (t < 1) throw new Error("degree must be at least 1 (linear)"); if (t > o - 1) throw new Error("degree must be less than or equal to point count - 1"); const s = _ ?? new Array(o).fill(1), r = a ?? (() => { const A = []; for (let u = 0; u < o + t + 1; u++) A.push(u); return A; })(); if (r.length !== o + t + 1) throw new Error("bad knot vector length"); const l = [t, r.length - 1 - t], d = r[l[0]], I = r[l[1]]; n = n * (I - d) + d, n = Math.max(n, d), n = Math.min(n, I); let c = l[0]; for (; c < l[1] && !(n >= r[c] && n <= r[c + 1]); c++) ; const E = new Array(o); for (let A = 0; A < o; A++) { E[A] = new Array(i + 1); for (let u = 0; u < i; u++) E[A][u] = e[A][u] * s[A]; E[A][i] = s[A]; } for (let A = 1; A <= t + 1; A++) for (let u = c; u > c - t - 1 + A; u--) { const T = r[u + t + 1 - A] - r[u], h = T === 0 ? 0 : (n - r[u]) / T; for (let Y = 0; Y < i + 1; Y++) E[u][Y] = (1 - h) * E[u - 1][Y] + h * E[u][Y]; } const C = new Array(i); for (let A = 0; A < i; A++) C[A] = On(E[c][A] / E[c][i], -9); return C; } function On(n, t) { if (isNaN(n) || !Number.isInteger(t)) return NaN; const [e, a = "0"] = n.toString().split("e"), _ = Math.round(+`${e}e${+a - t}`), [o, i = "0"] = _.toString().split("e"); return +`${o}e${+i + t}`; } const J = { aliceblue: 15792383, antiquewhite: 16444375, aqua: 65535, aquamarine: 8388564, azure: 15794175, beige: 16119260, bisque: 16770244, black: 0, blanchedalmond: 16772045, blue: 255, blueviolet: 9055202, brown: 10824234, burlywood: 14596231, cadetblue: 6266528, chartreuse: 8388352, chocolate: 13789470, coral: 16744272, cornflowerblue: 6591981, cornsilk: 16775388, crimson: 14423100, cyan: 65535, darkblue: 139, darkcyan: 35723, darkgoldenrod: 12092939, darkgray: 11119017, darkgreen: 25600, darkkhaki: 12433259, darkmagenta: 9109643, darkolivegreen: 5597999, darkorange: 16747520, darkorchid: 10040012, darkred: 9109504, darksalmon: 15308410, darkseagreen: 9419919, darkslateblue: 4734347, darkslategray: 3100495, darkturquoise: 52945, darkviolet: 9699539, deeppink: 16716947, deepskyblue: 49151, dimgrey: 6908265, dodgerblue: 2003199, firebrick: 11674146, floralwhite: 16775920, forestgreen: 2263842, fuchsia: 16711935, gainsboro: 14474460, ghostwhite: 16316671, gold: 16766720, goldenrod: 14329120, gray: 8421504, green: 32768, greenyellow: 11403055, grey: 8421504, honeydew: 15794160, hotpink: 16738740, indianred: 13458524, indigo: 4915330, ivory: 16777200, khaki: 15787660, lavender: 15132410, lavenderblush: 16773365, lawngreen: 8190976, lemonchiffon: 16775885, lightblue: 11393254, lightcoral: 15761536, lightcyan: 14745599, lightgoldenrodyellow: 16448210, lightgray: 13882323, lightgreen: 9498256, lightgrey: 13882323, lightpink: 16758465, lightsalmon: 16752762, lightseagreen: 2142890, lightskyblue: 8900346, lightslategray: 7833753, lightslategrey: 7833753, lightsteelblue: 11584734, lightyellow: 16777184, lime: 65280, limegreen: 3329330, linen: 16445670, magenta: 16711935, maroon: 8388608, mediumaquamarine: 6737322, mediumblue: 205, mediumorchid: 12211667, mediumpurple: 9662683, mediumseagreen: 3978097, mediumslateblue: 8087790, mediumspringgreen: 64154, mediumturquoise: 4772300, mediumvioletred: 13047173, midnightblue: 1644912, mintcream: 16121850, mistyrose: 16770273, moccasin: 16770229, navajowhite: 16768685, navy: 128, oldlace: 16643558, olive: 8421376, olivedrab: 7048739, orange: 16753920, orangered: 16729344, orchid: 14315734, palegoldenrod: 15657130, palegreen: 10025880, paleturquoise: 11529966, palevioletred: 14381203, papayawhip: 16773077, peachpuff: 16767673, peru: 13468991, pink: 16761035, plum: 14524637, powderblue: 11591910, purple: 8388736, rebeccapurple: 6697881, red: 16711680, rosybrown: 12357519, royalblue: 4286945, saddlebrown: 9127187, salmon: 16416882, sandybrown: 16032864, seagreen: 3050327, seashell: 16774638, sienna: 10506797, silver: 12632256, skyblue: 8900331, slateblue: 6970061, slategrey: 7372944, snow: 16775930, springgreen: 65407, steelblue: 4620980, tan: 13808780, teal: 32896, thistle: 14204888, tomato: 16737095, turquoise: 4251856, violet: 15631086, wheat: 16113331, white: 16777215, whitesmoke: 16119285, yellow: 16776960, yellowgreen: 10145074 }, lt = [ 0, 16711680, 16776960, 65280, 65535, 255, 16711935, 16777215, 8421504, 12632256, 16711680, 16744319, 13369344, 13395558, 10027008, 10046540, 8323072, 8339263, 4980736, 4990502, 16727808, 16752511, 13382400, 13401958, 10036736, 10051404, 8331008, 8343359, 4985600, 4992806, 16744192, 16760703, 13395456, 13408614, 10046464, 10056268, 8339200, 8347455, 4990464, 4995366, 16760576, 16768895, 13408512, 13415014, 10056192, 10061132, 8347392, 8351551, 4995328, 4997670, 16776960, 16777087, 13421568, 13421670, 10000384, 10000460, 8355584, 8355647, 5000192, 5000230, 12582656, 14679935, 10079232, 11717734, 7510016, 8755276, 6258432, 7307071, 3755008, 4344870, 8388352, 12582783, 6736896, 10079334, 5019648, 7510092, 4161280, 6258495, 2509824, 3755046, 4194048, 10485631, 3394560, 8375398, 2529280, 6264908, 2064128, 5209919, 1264640, 3099686, 65280, 8388479, 52224, 6736998, 38912, 5019724, 32512, 4161343, 19456, 2509862, 65343, 8388511, 52275, 6737023, 38950, 5019743, 32543, 4161359, 19475, 2509871, 65407, 8388543, 52326, 6737049, 38988, 5019762, 32575, 4161375, 19494, 2509881, 65471, 8388575, 52377, 6737074, 39026, 5019781, 32607, 4161391, 19513, 2509890, 65535, 8388607, 52428, 6737100, 39064, 5019800, 32639, 4161407, 19532, 2509900, 49151, 8380415, 39372, 6730444, 29336, 5014936, 24447, 4157311, 14668, 2507340, 32767, 8372223, 26316, 6724044, 19608, 5010072, 16255, 4153215, 9804, 2505036, 16383, 8364031, 13260, 6717388, 9880, 5005208, 8063, 4149119, 4940, 2502476, 255, 8355839, 204, 6710988, 152, 5000344, 127, 4145023, 76, 2500172, 4129023, 10452991, 3342540, 8349388, 2490520, 6245528, 2031743, 5193599, 1245260, 3089996, 8323327, 12550143, 6684876, 10053324, 4980888, 7490712, 4128895, 6242175, 2490444, 3745356, 12517631, 14647295, 10027212, 11691724, 7471256, 8735896, 6226047, 7290751, 3735628, 4335180, 16711935, 16744447, 13369548, 13395660, 9961624, 9981080, 8323199, 8339327, 4980812, 4990540, 16711871, 16744415, 13369497, 13395634, 9961586, 9981061, 8323167, 8339311, 4980793, 4990530, 16711807, 16744383, 13369446, 13395609, 9961548, 9981042, 8323135, 8339295, 4980774, 4990521, 16711743, 16744351, 13369395, 13395583, 9961510, 9981023, 8323103, 8339279, 4980755, 4990511, 3355443, 5987163, 8684676, 11382189, 14079702, 16777215, 0 ]; function $(n, t, e) { return Math.max(t, Math.min(e, n)); } const j = class j { constructor() { N(this, "_colorIndex"); N(this, "_color"); N(this, "_colorName"); this._colorIndex = 256, this._color = null, this._colorName = null; } get color() { return this._color; } set color(t) { t == null ? this._color = null : (this._color = Math.round($(t, 0, 256 * 256 * 256 - 1)), this._colorIndex = this.getColorIndexByValue(this._color), this._colorName = this.getColorNameByValue(this._color)); } get hexColor() { if (this._color && this._color > 0 && this._color <= 16777215) { let t = this._color.toString(16).toUpperCase(); for (; t.length < 6; ) t = "0" + t; return `0x${t}`; } return ""; } get cssColor() { return `rgb(${this.red},${this.green},${this.blue})`; } get red() { return this.color != null ? this.color >> 16 & 255 : null; } get green() { return this.color != null ? this.color >> 8 & 255 : null; } get blue() { return this.color != null ? this.color & 255 : null; } /** * AutoCAD color index value. The index value will be in the range 0 to 256. 0 and 256 are special values. * If value less than 0 is set, 0 will be used. If value greater than 256 is set, 256 will be used. * - 0 indicates that the entity uses the color of the BlockReference that's displaying it. If the entity * is not displayed through a block reference (for example, it is directly owned by the model space * block table record) and its color is 0, then it will display as though its color were 7. * - 256 indicates that the entity uses the color specified in the layer table record it references. */ get colorIndex() { return this._colorIndex; } set colorIndex(t) { t == null ? this._colorIndex = null : (this._colorIndex = $(t, 0, 256), this._color = lt[t], this._colorName = this.getColorNameByValue(this._color)); } get colorName() { return this._colorName; } set colorName(t) { if (t) { const e = J[t.toLowerCase()]; e !== void 0 ? (this._colorName = t, this._color = e, this._colorIndex = this.getColorIndexByValue(this._color)) : console.warn("Unknown color: " + t); } else this._colorName = null; } get hasColorName() { return this._colorName == null; } get hasColorIndex() { return this._colorIndex == null; } get isByLayer() { return this.colorIndex == 256; } setByLayer() { return this.colorIndex = 256, this; } get isByBlock() { return this.colorIndex == 0; } setByBlock() { return this.colorIndex = 0, this; } setScalar(t) { return this.setRGB(t, t, t), this; } setRGB(t, e, a) { const _ = Math.round($(t, 0, 255)), o = Math.round($(e, 0, 255)), i = Math.round($(a, 0, 255)); return this.color = (_ << 16) + (o << 8) + i, this; } setColorName(t) { const e = J[t.toLowerCase()]; return e !== void 0 ? this.color = e : console.warn("Unknown color " + t), this; } clone() { const t = new j(); return t.colorIndex = this.colorIndex, t.color = this.color, t._colorName = this._colorName, this; } copy(t) { return this.colorIndex = t.colorIndex, this.color = t.color, this._colorName = t._colorName, this; } equals(t) { return t.color == this.color && t.colorIndex == this.colorIndex && t._colorName == this._colorName; } toString() { return this.isByLayer ? "ByLayer" : this.isByBlock ? "ByBlock" : this.colorName ? this.colorName : this.hexColor; } getColorNameByValue(t) { for (const [e, a] of Object.entries(J)) if (a === t) return e; return null; } getColorIndexByValue(t) { const e = lt.length - 1; for (let a = 1; a < e; ++a) if (lt[a] === t) return a; return null; } }; N(j, "NAMES", J); let ut = j; class W { constructor(t, e) { N(this, "x"); N(this, "y"); this.x = t, this.y = e; } add(t) { return new W(this.x + t.x, this.y + t.y); } sub(t) { return new W(this.x - t.x, this.y - t.y); } multiply(t) { return new W(this.x * t, this.y * t); } length() { return Math.sqrt(this.x ** 2 + this.y ** 2); } norm() { const t = this.length(); return t === 0 ? new W(0, 0) : new W(this.x / t, this.y / t); } } function wn(n, t, e, a = 5) { let _, o, i; e < 0 ? (_ = Math.atan(-e) * 4, o = new W(n.x, n.y), i = new W(t.x, t.y)) : (_ = Math.atan(e) * 4, o = new W(t.x, t.y), i = new W(n.x, n.y)); const s = i.sub(o), r = s.length(), l = o.add(s.multiply(0.5)), d = Math.abs(r / 2 / Math.tan(_ / 2)), I = s.norm(), c = new W(I.x * Math.cos(Math.PI / 2) - I.y * Math.sin(Math.PI / 2), I.y * Math.cos(Math.PI / 2) + I.x * Math.sin(Math.PI / 2)), E = _ < Math.PI ? l.add(c.multiply(-d)) : l.add(c.multiply(d)), C = Math.atan2(i.y - E.y, i.x - E.x) / Math.PI * 180; let A = Math.atan2(o.y - E.y, o.x - E.x) / Math.PI * 180; A < C && (A += 360); const u = i.sub(E).length(), T = Math.floor(C / a) * a + a, h = Math.ceil(A / a) * a - a, Y = []; for (let R = T; R <= h; R += a) { const f = R / 180 * Math.PI, v = E.add(new W(Math.cos(f) * u, Math.sin(f) * u)); Y.push(v); } return e < 0 && Y.reverse(), Y; } function Bn(n, t = !1) { let e = []; const a = n.vertices.map((_) => ({ x: _.x, y: _.y, bulge: _.bulge })); t && a.push(a[0]); for (let _ = 0, o = a.length; _ < o - 1; ++_) { const i = a[_], s = a[_ + 1]; e.push(i), a[_].bulge && (e = e.concat(wn(i, s, n.vertices[_].bulge))), _ === o - 2 && e.push(s); } return e; } class Fn { constructor() { N(this, "blockMap", /* @__PURE__ */ new Map()); } rotate(t, e) { const a = Math.cos(e), _ = Math.sin(e); return { x: t.x * a - t.y * _, y: t.x * _ + t.y * a }; } /** * Interpolates a B-spline curve and returns the resulting polyline. * * @param controlPoints The control points of the B-spline. * @param degree The degree of the B-spline. * @param knots The knot vector. * @param interpolationsPerSplineSegment Number of interpolated points per spline segment. * @param weights Optional weight vector for rational B-splines. * @returns An array of interpolated 2D points representing the polyline. */ interpolateBSpline(t, e, a, _ = 25, o) { const i = [], s = t.map((d) => [d.x, d.y]), r = [a[e]], l = [ a[e], a[a.length - 1 - e] ]; for (let d = e + 1; d < a.length - e; ++d) r[r.length - 1] !== a[d] && r.push(a[d]); for (let d = 1; d < r.length; ++d) { const I = r[d - 1], c = r[d]; for (let E = 0; E <= _; ++E) { let A = (E / _ * (c - I) + I - l[0]) / (l[1] - l[0]); A = Math.max(0, Math.min(1, A)); const u = mn(A, e, s, a, o); i.push({ x: u[0], y: u[1] }); } } return i; } addFlipXIfApplicable(t, { bbox: e, element: a }) { return "extrusionDirection" in t && t.extrusionDirection.z === -1 ? { bbox: new D().expandByPoint({ x: -e.min.x, y: e.min.y }).expandByPoint({ x: -e.max.x, y: e.max.y }), element: `${a}` } : { bbox: e, element: a }; } line(t) { const e = new D().expandByPoint({ x: t.startPoint.x, y: t.startPoint.y }).expandByPoint({ x: t.endPoint.x, y: t.endPoint.y }), a = ``; return { bbox: e, element: a }; } ray(t) { const a = t.firstPoint, _ = { x: a.x + t.unitDirection.x * 1e4, y: a.y + t.unitDirection.y * 1e4 }, o = new D().expandByPoint(a).expandByPoint(_), i = ``; return { bbox: o, element: i }; } xline(t) { const a = { x: t.firstPoint.x - t.unitDirection.x * 1e4, y: t.firstPoint.y - t.unitDirection.y * 1e4 }, _ = { x: t.firstPoint.x + t.unitDirection.x * 1e4, y: t.firstPoint.y + t.unitDirection.y * 1e4 }, o = new D().expandByPoint(a).expandByPoint(_), i = ``; return { bbox: o, element: i }; } extractMTextLines(t) { return t.replace(/\\U\+([0-9A-Fa-f]{4})/g, (e, a) => String.fromCharCode(parseInt(a, 16))).replace(/\\P/g, ` `).replace(/\\[LOlo]/g, "").replace(/\\[Ff][^;\\]*?(?:\|[^;\\]*)*;/g, "").replace(/\\[KkCcHhWwTtAa][^;\\]*;?/g, "").replace(/\\[a-zA-Z]+;?/g, "").replace(/%%(d|p|c|%)/gi, "").replace(/\\\\/g, "\\").replace(/\\~/g, " ").replace(/[{}]/g, "").split(` `).map((e) => e.trim()).filter((e) => e.length > 0); } lines(t, e, a, _, o = "start") { const i = new D().expandByPoint({ x: a.x, y: a.y }).expandByPoint({ x: a.x + _, y: a.y - t.length * e * 1.5 }), s = t.map((r, l) => { const d = a.x, I = a.y - l * e * 1.5, c = `translate(${d},${I}) scale(1,-1) translate(${-d},${-I})`; return `${r}`; }); return { bbox: i, element: s.join(` `) }; } mtext(t) { const e = t.textHeight, a = t.insertionPoint, _ = this.extractMTextLines(t.text), o = t.attachmentPoint; let i = "start"; return o == m.BottomCenter || o == m.MiddleCenter || o == m.TopCenter ? i = "middle" : (o == m.BottomRight || o == m.MiddleRight || o == m.TopRight) && (i = "end"), this.lines(_, e, a, t.extentsWidth, i); } table(t) { const { rowCount: e, columnCount: a, rowHeightArr: _, columnWidthArr: o, startPoint: i, cells: s } = t, r = i.x, l = i.y, d = []; for (let u = 0, T = l; u < e; u++) { const h = _[u]; let Y = r; for (let R = 0; R < a; R++) { const f = u * a + R, v = s[f], G = o[R]; d.push({ x: Y, y: T, width: G, height: h, cell: v, row: u, col: R }), Y += G; } T += h; } const I = d.map(({ x: u, y: T, width: h, height: Y, cell: R }) => { const f = []; R.topBorderVisibility && f.push(``), R.bottomBorderVisibility && f.push(``), R.leftBorderVisibility && f.push(``), R.rightBorderVisibility && f.push(``); const v = u + h / 2, G = T + Y / 2 + R.textHeight / 3, S = `${R.text}`; return [...f, S].join(` `); }).join(` `), c = o.reduce((u, T) => u + T, 0), E = _.reduce((u, T) => u + T, 0), C = new D().expandByPoint({ x: r, y: l }).expandByPoint({ x: r + c, y: l + E }), A = ` ${I} `.trim(); return { bbox: C, element: A }; } text(t) { const e = t.textHeight, a = t.startPoint, _ = [t.text]; let o = t.endPoint.x - t.endPoint.x; t.halign == 0 && (o = t.text.length * e + t.startPoint.x); let i = "start"; return t.halign == Q.CENTER ? i = "middle" : t.halign == Q.RIGHT && (i = "end"), this.lines(_, e, a, o, i); } vertices(t, e = !1) { const a = t.reduce((o, i) => o.expandByPoint(i), new D()); let _ = t.reduce((o, i, s) => (o += s === 0 ? "M" : "L", o += i.x + "," + i.y, o), ""); return e && (_ += "Z"), { bbox: a, element: `` }; } circle(t) { const e = new D().expandByPoint({ x: t.center.x + t.radius, y: t.center.y + t.radius }).expandByPoint({ x: t.center.x - t.radius, y: t.center.y - t.radius }), a = ``; return { bbox: e, element: a }; } ellipseOrArc(t, e, a, _, o, i, s) { const r = Math.sqrt(a * a + _ * _), l = o * r, d = -Math.atan2(-_, a), I = this.bboxEllipseOrArc(t, e, a, _, o, i, s); if (Math.abs(i - s) < 1e-9 || Math.abs(i - s + Math.PI * 2) < 1e-9) { const c = ``; return { bbox: I, element: c }; } else { const c = this.rotate({ x: Math.cos(i) * r, y: Math.sin(i) * l }, d), E = { x: t + c.x, y: e + c.y }, C = this.rotate({ x: Math.cos(s) * r, y: Math.sin(s) * l }, d), A = { x: t + C.x, y: e + C.y }, T = (s < i ? s + Math.PI * 2 : s) - i < Math.PI ? 0 : 1, Y = ``; return { bbox: I, element: Y }; } } bboxEllipseOrArc(t, e, a, _, o, i, s) { for (; i < 0; ) i += Math.PI * 2; for (; s <= i; ) s += Math.PI * 2; const r = []; if (Math.abs(a) < 1e-12 || Math.abs(_) < 1e-12) for (let E = 0; E < 4; E++) r.push(E / 2 * Math.PI); else r[0] = Math.atan(-_ * o / a) - Math.PI, r[1] = Math.atan(a * o / _) - Math.PI, r[2] = r[0] - Math.PI, r[3] = r[1] - Math.PI; for (let E = 4; E >= 0; E--) { for (; r[E] < i; ) r[E] += Math.PI * 2; r[E] > s && r.splice(E, 1); } r.push(i), r.push(s); const l = r.map((E) => ({ x: Math.cos(E), y: Math.sin(E) })), d = [ [a, -_ * o], [_, a * o] ]; return l.map((E) => ({ x: E.x * d[0][0] + E.y * d[0][1] + t, y: E.x * d[1][0] + E.y * d[1][1] + e })).reduce((E, C) => (E.expandByPoint(C), E), new D()); } ellipse(t) { const { bbox: e, element: a } = this.ellipseOrArc(t.center.x, t.center.y, t.majorAxisEndPoint.x, t.majorAxisEndPoint.y, t.axisRatio, t.startAngle, t.endAngle); return { bbox: e, element: a }; } arc(t) { const { bbox: e, element: a } = this.ellipseOrArc(t.center.x, t.center.y, t.radius, 0, 1, t.startAngle, t.endAngle); return { bbox: e, element: a }; } dimension(t) { const e = this.blockMap.get(t.name); return e ? { bbox: e.bbox, element: `` } : null; } insert(t) { const e = this.blockMap.get(t.name); if (e) { const a = t.insertionPoint, _ = t.rotation * (180 / Math.PI), o = `translate(${a.x},${a.y}) rotate(${_}) scale(${t.xScale},${t.yScale})`; return { bbox: e.bbox.clone().transform({ x: t.xScale, y: t.yScale }, { x: a.x, y: a.y }).rotate(t.rotation, a), element: `` }; } return null; } block(t, e) { const a = t.entities, { bbox: _, elements: o } = a.reduce((i, s) => { const r = this.entityToBoundsAndElement(s); if (r) { const { bbox: l, element: d } = r; l.valid && (i.bbox.expandByPoint(l.min), i.bbox.expandByPoint(l.max)); const I = this.getEntityColor(e.tables.LAYER.entries, s), c = s.type == "TEXT" || s.type == "MTEXT" ? I.cssColor : "none"; I.isByBlock ? i.elements.push(`${d}`) : i.elements.push(`${d}`); } return i; }, { bbox: new D(), elements: [] }); return _.valid ? { bbox: _, element: `${o.join(` `)}` } : null; } entityToBoundsAndElement(t) { let e = null; switch (t.type) { case "ARC": e = this.arc(t); break; case "CIRCLE": e = this.circle(t); break; case "DIMENSION": e = this.dimension(t); break; case "ELLIPSE": e = this.ellipse(t); break; case "INSERT": e = this.insert(t); break; case "LINE": e = this.line(t); break; case "LWPOLYLINE": { const a = t, _ = !!(a.flag & 512), o = Bn(a, _); e = this.vertices(o, _); break; } case "MTEXT": e = this.mtext(t); break; case "SPLINE": { const a = t; e = this.vertices(this.interpolateBSpline(a.controlPoints, a.degree, a.knots, 25, a.weights)); break; } case "POLYLINE": break; case "RAY": e = this.ray(t); break; case "TABLE": e = this.table(t); break; case "TEXT": e = this.text(t); break; case "XLINE": e = this.xline(t); break; default: e = null; break; } return e ? this.addFlipXIfApplicable(t, e) : null; } getEntityColor(t, e) { const a = new ut(); if (e.colorIndex != null ? a.colorIndex = e.colorIndex : e.colorName ? a.colorName = e.colorName : e.color != null && (a.color = e.color), a.colorIndex == 7 && (a.colorIndex = 256), a.isByLayer) { const _ = t.find((o) => o.name === e.layer); _ != null && (a.colorIndex = _.colorIndex); } return a.color == null && (a.color = 16777215), a; } convert(t) { let e = null; this.blockMap.clear(); let a = ""; t.tables.BLOCK_RECORD.entries.forEach((i) => { if (Bt(i.name)) e = i; else { const s = this.block(i, t); s && (a += s.element, this.blockMap.set(i.name, s)); } }); const _ = this.block(e, t), o = _ && _.bbox.valid ? { x: _.bbox.min.x, y: -_.bbox.max.y, width: _.bbox.max.x - _.bbox.min.x, height: _.bbox.max.y - _.bbox.min.y } : { x: 0, y: 0, width: 0, height: 0 }; return ` ${a} ${_ ? _.element : ""} `; } } var Ot; (function(n) { n[n.BMP = 2] = "BMP", n[n.WMF = 3] = "WMF", n[n.PNG = 6] = "PNG"; })(Ot || (Ot = {})); const tt = class tt { constructor(t) { N(this, "wasmInstance"); N(this, "decoder"); return this.wasmInstance = t, new Proxy(this, { get: (e, a, _) => a in e ? Reflect.get(e, a, _) : Reflect.get(e.wasmInstance, a, _) }); } dwg_read_data(t, e) { if (e == ct.DWG) { const a = "tmp.dwg"; try { this.wasmInstance.FS.writeFile(a, new Uint8Array(t)); const _ = this.wasmInstance.dwg_read_file(a); return _.error != 0 && console.log("Open dwg file with error code: ", _.error), _.data; } finally { this.wasmInstance.FS.analyzePath(a, !1).exists && this.wasmInstance.FS.unlink(a); } } } /** * Converts DWG file content to DXF file content. * @param fileContent DWG file content. * @returns Returns DXF file content if conversion succeeds. Otherwise returns null. */ dwg_write_dxf(t) { const e = "tmp.dwg", a = "tmp.dxf"; try { this.wasmInstance.FS.writeFile(e, new Uint8Array(t)); const _ = this.wasmInstance.dwg_write_dxf(e, a); return _ != 0 ? (console.log("Convert dwg to dxf with error code: ", _), null) : this.wasmInstance.FS.readFile(a); } finally { this.wasmInstance.FS.analyzePath(e, !1).exists && this.wasmInstance.FS.unlink(e), this.wasmInstance.FS.analyzePath(a, !1).exists && this.wasmInstance.FS.unlink(a); } } /** * Gets the version of the dwg. * @param data Pointer to Dwg_Data instance. * @returns Return the version of the dwg */ dwg_get_version_type(t) { const e = this.wasmInstance.dwg_get_version_type(t); return Wn[e]; } /** * Gets code page of the dwg. * @param data Pointer to Dwg_Data instance. * @returns Return code page of the dwg */ dwg_get_codepage(t) { return this.wasmInstance.dwg_get_codepage(t); } /** * Extracts thumbnail image from dwg. * @param data Pointer to Dwg_Data instance. * @returns Return thumbnail image data */ dwg_bmp(t) { return this.wasmInstance.dwg_bmp(t); } /** * Returns the number of classes in dwg file. * @param data Pointer to Dwg_Data instance. * @returns Returns the number of classes in dwg file. */ dwg_get_num_classes(t) { return this.wasmInstance.dwg_get_num_classes(t); } /** * Returns the nth class in dwg file. * @param data Pointer to Dwg_Data instance. * @param index Index of the class * @returns Returns the nth class in dwg file. */ dwg_get_class(t, e) { return this.wasmInstance.dwg_get_class(t, e); } /** * Converts Dwg_Data instance to DwgDatabase instance. DwgDatabase instance doesn't depend on * Dwg_Data instance any more after conversion. So you can call function dwg_free to free memory * occupied by Dwg_Data. * @param data Pointer to Dwg_Data instance. * @returns Returns the converted DwgDatabase. */ convert(t) { const e = this.dwg_get_codepage(t), a = At(e); return this.decoder = new TextDecoder(a), new mt(this).convert(t); } /** * Converts Dwg_Data instance to DwgDatabase instance and returns conversion statistics. * DwgDatabase instance doesn't depend on Dwg_Data instance any more after conversion. * So you can call function dwg_free to free memory occupied by Dwg_Data. * @param data Pointer to Dwg_Data instance. * @returns Returns the converted DwgDatabase and conversion statistics. */ convertEx(t) { const e = this.dwg_get_codepage(t), a = At(e); this.decoder = new TextDecoder(a); const _ = new mt(this); return { database: _.convert(t), stats: _.getConversionStats() }; } /** * Converts DwgDatabase instance to svg string. * @param data DwgDatabase instance. * @returns Returns the converted svg string. */ dwg_to_svg(t) { return new Fn().convert(t); } /** * Frees the whole DWG. all tables, sections, objects, ... * @param data Pointer to Dwg_Data instance. */ dwg_free(t) { this.wasmInstance.dwg_free(t); } /** * Frees the object (all three structs and its fields) * @group Dwg_Object Methods * @param ptr Pointer to one Dwg_Object instance. */ dwg_free_object(t) { this.wasmInstance.dwg_free_object(t); } /** * Gets an object by its handle. * @group Handle Conversion Methods * @param data Pointer to Dwg_Data instance. * @param ref_ptr Pointer to Dwg_Object_Ref instance. * @returns Returns the object whose handle is equal to the given handle. */ dwg_ref_object(t, e) { return this.wasmInstance.dwg_ref_object(t, e); } /** * Gets an object by its handle without warning message. * @group Handle Conversion Methods * @param data Pointer to Dwg_Data instance. * @param ref_ptr Pointer to Dwg_Object_Ref instance. * @returns Returns the object whose handle is equal to the given handle. */ dwg_ref_object_silent(t, e) { return this.wasmInstance.dwg_ref_object_silent(t, e); } /** * Gets an object given its handle and relative base object. * @group Handle Conversion Methods * @param data Pointer to Dwg_Data instance. * @param ref_ptr Pointer to Dwg_Object_Ref instance. * @param obj_ptr Pointer to the relative base object (Dwg_Object instance). * @returns Returns the object given its handle and relative base object. */ dwg_ref_object_relative(t, e, a) { return this.wasmInstance.dwg_ref_object_relative(t, e, a); } /** * Resolves handle absref value to Dwg_Object instance. * @group Handle Conversion Methods * @param data Pointer to Dwg_Data instance. * @param absref Handle absref value. * @returns Returns the object with the given handle absref value. */ dwg_resolve_handle(t, e) { return this.wasmInstance.dwg_resolve_handle(t, e); } /** * Resolves handle absref value to Dwg_Object instance without warning message. * @group Handle Conversion Methods * @param data Pointer to Dwg_Data instance. * @param absref Handle absref value. * @returns Returns the object with the given handle absref value. */ dwg_resolve_handle_silent(t, e) { return this.wasmInstance.dwg_resolve_handle_silent(t, e); } /** * Sets ref->absolute_ref from the specified obj for a subsequent dwg_resolve_handle * @group Handle Conversion Methods * @param ref_ptr Pointer to Dwg_Object_Ref instance. * @param obj_ptr Pointer to Dwg_Object instance. * @returns Returns 1 if set absref value correctly. Otherwise, return 0. */ dwg_resolve_handleref(t, e) { return this.wasmInstance.dwg_resolve_handleref(t, e); } /** * Returns object (such as line type, layer name, dimension style, and etc.) name by its handle. * @group Handle Conversion Methods * @param ref_ptr Pointer to Dwg_Object_Ref instance. * @returns Returns object name by its handle. */ dwg_ref_get_object_name(t) { const e = this.wasmInstance, a = e.dwg_ref_get_object(t), _ = e.dwg_object_to_object_tio(a); return this.dwg_dynapi_entity_value(_, "name").data; } /** * Converts Dwg_Object_Object instance to Dwg_Object instance. * @group Object Conversion Methods * @param obj_ptr Pointer to Dwg_Object_Object instance. * @returns Returns one pointer to Dwg_Object instance. */ dwg_obj_obj_to_object(t) { return this.wasmInstance.dwg_obj_obj_to_object(t); } /** * Converts Dwg_Object_* instance to Dwg_Object instance. * @group Object Conversion Methods * @param obj_generic_ptr Pointer to Dwg_Object_* instance. * @returns Returns one pointer to Dwg_Object instance. */ dwg_obj_generic_to_object(t) { return this.wasmInstance.dwg_obj_generic_to_object(t); } /** * Converts Dwg_Object instance to Dwg_Object_Object instance. * @group Object Conversion Methods * @param obj_ptr Pointer to Dwg_Object instance. * @returns Returns one pointer to Dwg_Object_Object instance. */ dwg_object_to_object(t) { return this.wasmInstance.dwg_object_to_object(t); } /** * Gets Dwg_Object_* instance (such as Dwg_Entity_LAYER, Dwg_Entity_STYLE, and etc.) * from Dwg_Object instance. * @group Object Conversion Methods * @param obj_ptr Pointer to Dwg_Object instance. * @returns Returns one pointer to Dwg_Object_Object_TIO_Ptr instance. */ dwg_object_to_object_tio(t) { return this.wasmInstance.dwg_object_to_object_tio(t); } /** * Converts Dwg_Object instance to Dwg_Object_Entity instance. * @group Object Conversion Methods * @param obj_ptr Pointer to Dwg_Object instance. * @returns Returns one pointer to Dwg_Object_Entity instance. */ dwg_object_to_entity(t) { return this.wasmInstance.dwg_object_to_entity(t); } /** * Gets Dwg_Entity_* instance (such as Dwg_Entity_LINE, Dwg_Entity_SPLINE, and etc.) * from Dwg_Object instance. * @group Object Conversion Methods * @param obj_ptr Pointer to Dwg_Object instance. * @returns Returns one pointer to Dwg_Object_Object_TIO_Ptr instance. */ dwg_object_to_entity_tio(t) { return this.wasmInstance.dwg_object_to_entity_tio(t); } /** * Returns all of entities in the model space. Each item in returned array * is one Dwg_Object pointer (Dwg_Object*). * @group GetAll Methods * @param data Pointer to Dwg_Data instance. * @returns Returns all of entities in the model space. */ dwg_getall_entities_in_model_space(t) { const e = this.wasmInstance, a = e.dwg_model_space_object(t), _ = []; let o = e.get_first_owned_entity(a); for (; o; ) _.push(o), o = e.get_next_owned_entity(a, o); return _; } /** * Returns all of objects in Dwg_Data instance with the specified type. * @group GetAll Methods * @param data Pointer to Dwg_Data instance. * @param type Object type. * @returns Returns all of objects with the specified type. */ dwg_getall_object_by_type(t, e) { const a = this.wasmInstance, _ = a.dwg_get_num_objects(t), o = []; for (let i = 0; i < _; i++) { const s = a.dwg_get_object(t, i), r = a.dwg_object_to_object_tio(s); r && a.dwg_object_get_fixedtype(s) == e && o.push(r); } return o; } /** * Returns all of objects in Dwg_Data instance with the specified type. * @group GetAll Methods * @param data Pointer to Dwg_Data instance. * @param type Object type. * @returns Returns all of objects with the specified type. */ dwg_getall_entity_by_type(t, e) { const a = this.wasmInstance, _ = a.dwg_get_num_objects(t), o = []; for (let i = 0; i < _; i++) { const s = a.dwg_get_object(t, i), r = a.dwg_object_to_entity_tio(s); r && a.dwg_object_get_fixedtype(s) == e && o.push(r); } return o; } /** * Returns all of layer objects in Dwg_Data instance. * @group GetAll Methods * @param data Pointer to Dwg_Data instance. * @returns Returns all of layer objects in Dwg_Data instance. */ dwg_getall_LAYER(t) { return this.dwg_getall_object_by_type(t, P.DWG_TYPE_LAYER); } /** * Returns all of line type objects in Dwg_Data instance. * @group GetAll Methods * @param data Pointer to Dwg_Data instance. * @returns Returns all of line type objects in Dwg_Data instance. */ dwg_getall_LTYPE(t) { return this.dwg_getall_object_by_type(t, P.DWG_TYPE_LTYPE); } /** * Returns all of text style objects in Dwg_Data instance. * @group GetAll Methods * @param data Pointer to Dwg_Data instance. * @returns Returns all of text style objects in Dwg_Data instance. */ dwg_getall_STYLE(t) { return this.dwg_getall_object_by_type(t, P.DWG_TYPE_STYLE); } /** * Returns all of dimension style objects in Dwg_Data instance. * @group GetAll Methods * @param data Pointer to Dwg_Data instance. * @returns Returns all of dimension style objects in Dwg_Data instance. */ dwg_getall_DIMSTYLE(t) { return this.dwg_getall_object_by_type(t, P.DWG_TYPE_DIMSTYLE); } /** * Returns all of viewport objects in Dwg_Data instance. * @group GetAll Methods * @param data Pointer to Dwg_Data instance. * @returns Returns all of viewport objects in Dwg_Data instance. */ dwg_getall_VPORT(t) { return this.dwg_getall_object_by_type(t, P.DWG_TYPE_VPORT); } /** * Returns all of layout objects in Dwg_Data instance. * @group GetAll Methods * @param data Pointer to Dwg_Data instance. * @returns Returns all of layout objects in Dwg_Data instance. */ dwg_getall_LAYOUT(t) { return this.dwg_getall_object_by_type(t, P.DWG_TYPE_LAYOUT); } /** * Returns all of block objects in Dwg_Data instance. * @group GetAll Methods * @param data Pointer to Dwg_Data instance. * @returns Returns all of block objects in Dwg_Data instance. */ dwg_getall_BLOCK(t) { return this.dwg_getall_object_by_type(t, P.DWG_TYPE_BLOCK); } /** * Returns all of block header objects in Dwg_Data instance. * @group GetAll Methods * @param data Pointer to Dwg_Data instance. * @returns Returns all of block header objects in Dwg_Data instance. */ dwg_getall_BLOCK_HEADER(t) { return this.dwg_getall_object_by_type(t, P.DWG_TYPE_BLOCK_HEADER); } /** * Returns all of image definition objects in Dwg_Data instance. * @group GetAll Methods * @param data Pointer to Dwg_Data instance. * @returns Returns all of image definition objects in Dwg_Data instance. */ dwg_getall_IMAGEDEF(t) { return this.dwg_getall_object_by_type(t, P.DWG_TYPE_IMAGEDEF); } /** * Returns all of 2d vertex objects in Dwg_Data instance. * @group GetAll Methods * @param data Pointer to Dwg_Data instance. * @returns Returns all of 2d vertex objects in Dwg_Data instance. */ dwg_getall_VERTEX_2D(t) { return this.dwg_getall_entity_by_type(t, P.DWG_TYPE_VERTEX_2D); } /** * Returns all of 3d vertex objects in Dwg_Data instance. * @group GetAll Methods * @param data Pointer to Dwg_Data instance. * @returns Returns all of 3d vertex objects in Dwg_Data instance. */ dwg_getall_VERTEX_3D(t) { return this.dwg_getall_entity_by_type(t, P.DWG_TYPE_VERTEX_3D); } /** * Returns all of 2d polyline entities in Dwg_Data instance. * @group GetAll Methods * @param data Pointer to Dwg_Data instance. * @returns Returns all of 2d polyline entities in Dwg_Data instance. */ dwg_getall_POLYLINE_2D(t) { return this.dwg_getall_entity_by_type(t, P.DWG_TYPE_POLYLINE_2D); } /** * Returns all of 3d polyline entities in Dwg_Data instance. * @group GetAll Methods * @param data Pointer to Dwg_Data instance. * @returns Returns all of 3d polyline entities in Dwg_Data instance. */ dwg_getall_POLYLINE_3D(t) { return this.dwg_getall_entity_by_type(t, P.DWG_TYPE_POLYLINE_3D); } /** * Returns all of image entities in Dwg_Data instance. * @group GetAll Methods * @param data Pointer to Dwg_Data instance. * @returns Returns all of image entities in Dwg_Data instance. */ dwg_getall_IMAGE(t) { return this.dwg_getall_entity_by_type(t, P.DWG_TYPE_IMAGE); } /** * Returns all of lwpolyline entities in Dwg_Data instance. * @group GetAll Methods * @param data Pointer to Dwg_Data instance. * @returns Returns all of lwpolyline entities in Dwg_Data instance. */ dwg_getall_LWPOLYLINE(t) { return this.dwg_getall_entity_by_type(t, P.DWG_TYPE_LWPOLYLINE); } /** * Converts one C++ handle array to one JavaScript Dwg_Object_Ref array. * @group Array Methods * @param ptr Pointer to C++ handle array. * @param size The size of C++ handle array. * @returns Returns one JavaScript Dwg_Object_Ref array from the specified C++ handle array. */ dwg_ptr_to_object_ref_array(t, e) { return this.wasmInstance.dwg_ptr_to_object_ref_array(t, e); } /** * Converts one C++ handle array to one JavaScript Dwg_Object_Ref_Ptr array. * @group Array Methods * @param ptr Pointer to C++ handle array. * @param size The size of C++ handle array. * @returns Returns one JavaScript Dwg_Object_Ref_Ptr array from the specified C++ handle array. */ dwg_ptr_to_object_ref_ptr_array(t, e) { return this.wasmInstance.dwg_ptr_to_object_ref_ptr_array(t, e); } /** * Converts one C++ wchar_t* array to one JavaScript string array. * @group Array Methods * @param ptr Pointer to C++ wchar_t* array. * @param size The size of C++ wchar_t* array. * @returns Returns one JavaScript string array from the specified C++ wchar_t* array. */ dwg_ptr_to_wchar_string_array(t, e) { return this.wasmInstance.dwg_ptr_to_wchar_string_array(t, e); } /** * Converts one C++ unsigned char array to one JavaScript number array. * @group Array Methods * @param ptr Pointer to C++ unsigned char array. * @param size The size of C++ unsigned char array. * @returns Returns one JavaScript number array from the specified C++ unsigned char array. */ dwg_ptr_to_unsigned_char_array(t, e) { return this.wasmInstance.dwg_ptr_to_unsigned_char_array(t, e); } /** * Converts one C++ signed char array to one JavaScript number array. * @group Array Methods * @param ptr Pointer to C++ signed char array. * @param size The size of C++ signed char array. * @returns Returns one JavaScript number array from the specified C++ signed char array. */ dwg_ptr_to_signed_char_array(t, e) { return this.wasmInstance.dwg_ptr_to_signed_char_array(t, e); } /** * Converts one C++ unsigned int16 array to one JavaScript number array. * @group Array Methods * @param ptr Pointer to C++ unsigned int16 array. * @param size The size of C++ unsigned int16 array. * @returns Returns one JavaScript number array from the specified C++ unsigned int16 array. */ dwg_ptr_to_uint16_t_array(t, e) { return this.wasmInstance.dwg_ptr_to_uint16_t_array(t, e); } /** * Converts one C++ int16 array to one JavaScript number array. * @group Array Methods * @param ptr Pointer to C++ int16 array. * @param size The size of C++ int16 array. * @returns Returns one JavaScript number array from the specified C++ int16 array. */ dwg_ptr_to_int16_t_array(t, e) { return this.wasmInstance.dwg_ptr_to_int16_t_array(t, e); } /** * Converts one C++ unsigned int32 array to one JavaScript number array. * @group Array Methods * @param ptr Pointer to C++ unsigned int32 array. * @param size The size of C++ unsigned int32 array. * @returns Returns one JavaScript number array from the specified C++ unsigned int32 array. */ dwg_ptr_to_uint32_t_array(t, e) { return this.wasmInstance.dwg_ptr_to_uint32_t_array(t, e); } /** * Converts one C++ int32 array to one JavaScript number array. * @group Array Methods * @param ptr Pointer to C++ int32 array. * @param size The size of C++ int32 array. * @returns Returns one JavaScript number array from the specified C++ int32 array. */ dwg_ptr_to_int32_t_array(t, e) { return this.wasmInstance.dwg_ptr_to_int32_t_array(t, e); } /** * Converts one C++ unsigned int64 array to one JavaScript number array. * @group Array Methods * @param ptr Pointer to C++ unsigned int64 array. * @param size The size of C++ unsigned int64 array. * @returns Returns one JavaScript number array from the specified C++ unsigned int64 array. */ dwg_ptr_to_uint64_t_array(t, e) { return this.wasmInstance.dwg_ptr_to_uint64_t_array(t, e); } /** * Converts one C++ int64 array to one JavaScript number array. * @group Array Methods * @param ptr Pointer to C++ int64 array. * @param size The size of C++ int64 array. * @returns Returns one JavaScript number array from the specified C++ int64 array. */ dwg_ptr_to_int64_t_array(t, e) { return this.wasmInstance.dwg_ptr_to_int64_t_array(t, e); } /** * Converts one C++ double array to one JavaScript number array. * @group Array Methods * @param ptr Pointer to C++ double array. * @param size The size of C++ double array. * @returns Returns one JavaScript number array from the specified C++ double array. */ dwg_ptr_to_double_array(t, e) { return this.wasmInstance.dwg_ptr_to_double_array(t, e); } /** * Converts one C++ 2d point array to one JavaScript 2d point array. * @group Array Methods * @param ptr Pointer to C++ 2d point array. * @param size The size of C++ 2 point array. * @returns Returns one JavaScript 2d point array from the specified C++ 2d point array. */ dwg_ptr_to_point2d_array(t, e) { return this.wasmInstance.dwg_ptr_to_point2d_array(t, e); } /** * Converts one C++ 3d point array to one JavaScript 3d point array. * @group Array Methods * @param ptr Pointer to C++ 3d point array. * @param size The size of C++ 3d point array. * @returns Returns one JavaScript 3d point array from the specified C++ 3d point array. */ dwg_ptr_to_point3d_array(t, e) { return this.wasmInstance.dwg_ptr_to_point3d_array(t, e); } /** * Converts one C++ 4d point array to one JavaScript 4d point array. * @group Array Methods * @param ptr Pointer to C++ 4d point array. * @param size The size of C++ 4d point array. * @returns Returns one JavaScript 4d point array from the specified C++ 4d point array. */ dwg_ptr_to_point4d_array(t, e) { return this.wasmInstance.dwg_ptr_to_point4d_array(t, e); } /** * Converts one C++ line type array to one JavaScript line type array. * @group Array Methods * @param ptr Pointer to C++ line type array. * @param size The size of C++ line type array. * @returns Returns one JavaScript line type array from the specified C++ line type array. */ dwg_ptr_to_ltype_dash_array(t, e) { return this.wasmInstance.dwg_ptr_to_ltype_dash_array(t, e); } /** * Converts one C++ table cell array to one JavaScript table cell array. * @group Array Methods * @group Dwg_Entity_TABLE Methods * @param ptr Pointer to C++ table cell array. * @param size The size of C++ table cell array. * @returns Returns one JavaScript table cell array from the specified C++ table cell array. */ dwg_ptr_to_table_cell_array(t, e) { return this.wasmInstance.dwg_ptr_to_table_cell_array(t, e); } /** * Converts one C++ hatch definition line array to one JavaScript hatch definition line array. * @group Array Methods * @group Dwg_Entity_HATCH Methods * @param ptr Pointer to C++ hatch definition line array. * @param size The size of C++ hatch definition line array. * @returns Returns one JavaScript hatch definition line array from the specified C++ hatch definition line array. */ dwg_ptr_to_hatch_defline_array(t, e) { return this.wasmInstance.dwg_ptr_to_hatch_defline_array(t, e); } /** * Converts one C++ hatch path array to one JavaScript hatch path array. * @group Array Methods * @group Dwg_Entity_HATCH Methods * @param ptr Pointer to C++ hatch path array. * @param size The size of C++ hatch path array. * @returns Returns one JavaScript hatch path array from the specified C++ hatch path array. */ dwg_ptr_to_hatch_path_array(t, e) { return this.wasmInstance.dwg_ptr_to_hatch_path_array(t, e); } /** * Converts one C++ hatch gradient color array to one JavaScript hatch gradient color array. * @group Array Methods * @group Dwg_Entity_HATCH Methods * @param ptr Pointer to C++ hatch gradient color array. * @param size The size of C++ hatch gradient color array. * @returns Returns one JavaScript hatch gradient color array from the specified C++ hatch gradient color array. */ dwg_ptr_to_hatch_gradient_color_array(t, e) { return this.wasmInstance.dwg_ptr_to_hatch_gradient_color_array(t, e); } /** * Converts one C++ mline vertex array to one JavaScript mline vertex array. * @group Array Methods * @group Dwg_Entity_MLINE Methods * @param ptr Pointer to C++ mline vertex array. * @param size The size of C++ mline vertex array. * @returns Returns one JavaScript mline vertex array from the specified C++ mline vertex array. */ dwg_ptr_to_mline_vertex_array(t, e) { return this.wasmInstance.dwg_ptr_to_mline_vertex_array(t, e); } /** * Generic field value getter. Used to get the field value of one object or entity. * @group Dynamic API Methods * @param obj Pointer to one object or entity * @param field Field name of one object or entity * @returns Returns the field value of one object or entity. */ dwg_dynapi_entity_value(t, e) { const a = this.wasmInstance.dwg_dynapi_entity_value(t, e); return a.bin && this.decoder && (a.data = this.decoder.decode(a.bin)), a; } /** * Header field value getter. Used to get the field value of dwg/dxf header. * @group Dynamic API Methods * @param data Pointer to Dwg_Data instance. * @param field Field name of header. * @returns Returns the field value of dwg/dxf header. */ dwg_dynapi_header_value(t, e) { return this.wasmInstance.dwg_dynapi_header_value(t, e); } /** * The common field value getter. Used to get the value of object or entity common fields. * @group Dynamic API Methods * @param obj Pointer to one object or entity * @param field The name of object or entity common fields. * @returns Returns the value of object or entity common fields. */ dwg_dynapi_common_value(t, e) { return this.wasmInstance.dwg_dynapi_common_value(t, e); } /** * The field of one object or entity may not be primitive type. It means one field may consist of * multiple sub-fields. This method is used to get the sub-field value of those complex field. * @group Dynamic API Methods * @param obj Pointer to one object or entity. * @param subclass The class name of the field with complex type. * @param field The field name of one object or entit. * @returns Returns the sub-field value of one complex field. */ dwg_dynapi_subclass_value(t, e, a) { return this.wasmInstance.dwg_dynapi_subclass_value(t, e, a); } /** * Returns the handle of one Dwg_Object instance. * @group Dwg_Object Methods * @param ptr Pointer to one Dwg_Object instance. * @returns Returns the handle of one Dwg_Object instance. */ dwg_object_get_handle_object(t) { return this.wasmInstance.dwg_object_get_handle_object(t); } /** * Returns the handle of one Dwg_Object_Object instance. * @group Dwg_Object_Object Methods * @param ptr Pointer to one Dwg_Object_Object instance. * @returns Returns the handle of one Dwg_Object_Object instance. */ dwg_object_object_get_handle_object(t) { return this.wasmInstance.dwg_object_object_get_handle_object(t); } /** * Returns the owner handle of one Dwg_Object_Object instance. * @group Dwg_Object_Object Methods * @param ptr Pointer to one Dwg_Object_Object instance. * @returns Returns the owner handle of one Dwg_Object_Object instance. */ dwg_object_object_get_ownerhandle_object(t) { return this.wasmInstance.dwg_object_object_get_ownerhandle_object(t); } /** * Returns the handle of one Dwg_Object_Entity instance. * @group Dwg_Object_Entity Methods * @param ptr Pointer to one Dwg_Object_Entity instance. * @returns Returns the handle of one Dwg_Object_Entity instance. */ dwg_object_entity_get_handle_object(t) { return this.wasmInstance.dwg_object_entity_get_handle_object(t); } /** * Returns the owner handle of one Dwg_Object_Entity instance. * @group Dwg_Object_Entity Methods * @param ptr Pointer to one Dwg_Object_Entity instance. * @returns Returns the owner handle of one Dwg_Object_Entity instance. */ dwg_object_entity_get_ownerhandle_object(t) { return this.wasmInstance.dwg_object_entity_get_ownerhandle_object(t); } /** * Returns hard-owner ID/handle to owner dictionary of one Dwg_Object_Entity instance. * @group Dwg_Object_Entity Methods * @param ptr Pointer to one Dwg_Object_Entity instance. * @returns Returns hard-owner ID/handle to owner dictionary of one Dwg_Object_Entity instance. */ dwg_object_entity_get_xdicobjhandle_object(t) { return this.wasmInstance.dwg_object_entity_get_xdicobjhandle_object(t); } /** * Returns the layer handle of one Dwg_Object_Entity instance. * @group Dwg_Object_Entity Methods * @param ptr Pointer to one Dwg_Object_Entity instance. * @returns Returns the layer handle of one Dwg_Object_Entity instance. */ dwg_object_entity_get_layer_object_ref(t) { return this.wasmInstance.dwg_object_entity_get_layer_object_ref(t); } /** * Returns the line type handle of one Dwg_Object_Entity instance. * @group Dwg_Object_Entity Methods * @param ptr Pointer to one Dwg_Object_Entity instance. * @returns Returns the line type handle of one Dwg_Object_Entity instance. */ dwg_object_entity_get_ltype_object_ref(t) { return this.wasmInstance.dwg_object_entity_get_ltype_object_ref(t); } /** * Returns color value of one Dwg_Object_Entity instance. * @group Dwg_Object_Entity Methods * @param ptr Pointer to one Dwg_Object_Entity instance. * @returns Returns color value of one Dwg_Object_Entity instance. */ dwg_object_entity_get_color_object(t) { return this.wasmInstance.dwg_object_entity_get_color_object(t); } /** * Returns xdata of one Dwg_Object_Entity instance. * @group Dwg_Object_Entity Methods * @param ptr Pointer to one Dwg_Object_Entity instance. * @returns Returns xdata of one Dwg_Object_Entity instance. */ dwg_object_entity_get_xdata(t) { return this.wasmInstance.dwg_object_entity_get_xdata(t); } /** * Returns pointer to BLOCK_HEADER owner for generic entity from ent->ownerhandle. * @group Dwg_Object_Entity Methods * @param ptr Pointer to one Dwg_Object_Entity instance. * @returns Returns pointer to BLOCK_HEADER owner. */ dwg_entity_owner(t) { return this.wasmInstance.dwg_entity_owner(t); } /** * Returns block name of one Dwg_Entity_* instance with one block field. For example, * dimension entities have one 'block' field which represents the block that contains * the entities that make up the dimension picture. * @group Dwg_Entity_* Methods * @param ptr Pointer to one Dwg_Entity_* instance with one block field. * @param field Field name of the block. * @returns Returns block name of one Dwg_Entity_* instance. */ dwg_entity_get_block_name(t, e) { const a = this.wasmInstance, _ = a.dwg_dynapi_entity_value(t, e).data, o = a.dwg_ref_get_object(_), i = a.dwg_object_to_object_tio(o); return this.dwg_entity_block_header_get_block(i).name; } /** * Returns dimension style name of one Dwg_Entity_* instance with one dimension style * field. * @group Dwg_Entity_* Methods * @param ptr Pointer to one Dwg_Entity_* instance. * @param field Field name of the dimension style. * @returns Returns dimension style name of one Dwg_Entity_* instance. */ dwg_entity_get_dimstyle_name(t, e = "dimstyle") { const a = this.wasmInstance, _ = a.dwg_dynapi_entity_value(t, e).data, o = a.dwg_ref_get_object(_), i = a.dwg_object_to_object_tio(o); return this.dwg_dynapi_entity_value(i, "name").data; } /** * Returns block entity pointed by the specified block header. * @group Dwg_Entity_BLOCK_HEADER Methods * @param ptr Pointer to one Dwg_Entity_BLOCK_HEADER instance. * @returns Returns block entity pointed by the specified block header. */ dwg_entity_block_header_get_block(t) { const e = this.wasmInstance, a = e.dwg_dynapi_entity_value(t, "block_entity").data, _ = e.dwg_ref_get_object(a), o = e.dwg_object_to_entity_tio(_), i = e.dwg_dynapi_entity_value(o, "name").data, s = e.dwg_dynapi_entity_value(o, "base_pt").data; return { name: i, base_pt: s // preR13 only }; } /** * Returns preview image of the block pointed by the specified block header. * @group Dwg_Entity_BLOCK_HEADER Methods * @param ptr Pointer to one Dwg_Entity_BLOCK_HEADER instance. * @returns Returns preview image of the block pointed by the specified block header. */ dwg_entity_block_header_get_preview(t) { return this.wasmInstance.dwg_entity_block_header_get_preview(t).data; } /** * Returns the first entity owned by the block header or null * @group Dwg_Entity_BLOCK_HEADER Methods * @param ptr Pointer to the block header. * @returns Returns the first entity owned by the block header or null */ get_first_owned_entity(t) { return this.wasmInstance.get_first_owned_entity(t); } /** * Returns the next entity owned by the block header or null. * @group Dwg_Entity_BLOCK_HEADER Methods * @param ptr Pointer to the block header. * @param current Pointer to the current entity in the block header. * @returns Returns the next entity owned by the block header or null. */ get_next_owned_entity(t, e) { return this.wasmInstance.get_next_owned_entity(t, e); } /** * Returns text style name of one Dwg_Entity_MTEXT instance. * @group Dwg_Entity_MTEXT Methods * @param ptr Pointer to one Dwg_Entity_MTEXT instance. * @returns Returns text style name of one Dwg_Entity_MTEXT instance. */ dwg_entity_mtext_get_style_name(t) { const e = this.wasmInstance, a = e.dwg_dynapi_entity_value(t, "style").data, _ = e.dwg_ref_get_object(a), o = e.dwg_object_to_object_tio(_); return e.dwg_dynapi_entity_value(o, "name").data; } /** * Returns text style name of one Dwg_Entity_TEXT instance. * @group Dwg_Entity_TEXT Methods * @param ptr Pointer to one Dwg_Entity_TEXT instance. * @returns Returns text style name of one Dwg_Entity_TEXT instance. */ dwg_entity_text_get_style_name(t) { return this.dwg_entity_mtext_get_style_name(t); } /** * Returns the number of points in Dwg_Entity_POLYLINE_2D. * @group Dwg_Entity_POLYLINE_2D Methods * @param ptr Pointer to one Dwg_Object (not Dwg_Entity_POLYLINE_2D) instance. * @returns Returns the number of points in one Dwg_Entity_POLYLINE_2D. */ dwg_entity_polyline_2d_get_numpoints(t) { return this.wasmInstance.dwg_entity_polyline_2d_get_numpoints(t).data; } /** * Returns points in Dwg_Entity_POLYLINE_2D. * @group Dwg_Entity_POLYLINE_2D Methods * @param ptr Pointer to one Dwg_Object (not Dwg_Entity_POLYLINE_2D) instance. * @returns Returns points in one Dwg_Entity_POLYLINE_2D. */ dwg_entity_polyline_2d_get_points(t) { return this.wasmInstance.dwg_entity_polyline_2d_get_points(t).data; } /** * Returns vertices in Dwg_Entity_POLYLINE_2D. * @group Dwg_Entity_POLYLINE_2D Methods * @param ptr Pointer to one Dwg_Object (not Dwg_Entity_POLYLINE_2D) instance. * @returns Returns vertices in one Dwg_Entity_POLYLINE_2D. */ dwg_entity_polyline_2d_get_vertices(t) { return this.wasmInstance.dwg_entity_polyline_2d_get_vertices(t).data; } /** * Returns the number of points in Dwg_Entity_POLYLINE_3D. * @group Dwg_Entity_POLYLINE_3D Methods * @param ptr Pointer to one Dwg_Object (not Dwg_Entity_POLYLINE_3D) instance. * @returns Returns the number of points in one Dwg_Entity_POLYLINE_3D. */ dwg_entity_polyline_3d_get_numpoints(t) { return this.wasmInstance.dwg_entity_polyline_3d_get_numpoints(t).data; } /** * Returns points in Dwg_Entity_POLYLINE_3D. * @group Dwg_Entity_POLYLINE_3D Methods * @param ptr Pointer to one Dwg_Object (not Dwg_Entity_POLYLINE_3D) instance. * @returns Returns points in one Dwg_Entity_POLYLINE_3D. */ dwg_entity_polyline_3d_get_points(t) { return this.wasmInstance.dwg_entity_polyline_3d_get_points(t).data; } /** * Returns vertices in Dwg_Entity_POLYLINE_3D. * @group Dwg_Entity_POLYLINE_3D Methods * @param ptr Pointer to one Dwg_Object (not Dwg_Entity_POLYLINE_3D) instance. * @returns Returns vertices in one Dwg_Entity_POLYLINE_3D. */ dwg_entity_polyline_3d_get_vertices(t) { return this.wasmInstance.dwg_entity_polyline_3d_get_vertices(t).data; } /** * Returns attributes associated with INSERT entity. * @group Dwg_Entity_INSERT Methods * @param ptr Pointer to one Dwg_Object (not Dwg_Entity_INSERT) instance. * @returns Returns attributes associated with INSERT entity. */ dwg_entity_insert_get_attribs(t) { return this.wasmInstance.dwg_entity_insert_get_attribs(t).data; } /** * Returns texts in Dwg_Object_DICTIONARY. * @group Dwg_Object_DICTIONARY Methods * @param ptr Pointer to one Dwg_Object (not Dwg_Object_DICTIONARY) instance. * @returns Returns texts in one Dwg_Object_DICTIONARY. */ dwg_object_dictionary_get_texts(t) { return this.wasmInstance.dwg_object_dictionary_get_texts(t).data; } static createByWasmInstance(t) { return this.instance == null ? new tt(t) : this.instance; } static async create(t) { const e = t == null ? await yt() : await yt({ locateFile: (a) => `${t}/${a}` }); return this.createByWasmInstance(e); } }; N(tt, "instance"); let wt = tt; export { m as DwgAttachmentPoint, F as DwgBoundaryPathEdgeType, Nt as DwgBoundaryPathTypeFlag, It as DwgCodePage, gt as DwgDictionaryCloningFlags, Rt as DwgDimensionTextHorizontal, Tt as DwgDimensionTextLineSpacing, Ct as DwgDimensionTextVertical, ft as DwgDimensionToleranceTextVertical, Pt as DwgDimensionType, ht as DwgDimensionZeroSuppression, Yt as DwgDimensionZeroSuppressionAngular, Z as DwgHatchAssociativity, St as DwgHatchBoundaryAnnotation, q as DwgHatchGradientColorFlag, Et as DwgHatchGradientFlag, Lt as DwgHatchPatternType, z as DwgHatchSolidFill, vt as DwgHatchStyle, Gt as DwgPolylineFlag, Dt as DwgSmoothType, Wt as DwgTextGenerationFlag, Q as DwgTextHorizontalAlign, Mt as DwgTextVerticalAlign, Ot as DwgThumbnailImageType, pt as Dwg_Color_Method, ct as Dwg_File_Type, U as Dwg_Hatch_Edge_Type, xt as Dwg_Object_Supertype, P as Dwg_Object_Type, bn as Dwg_Object_Type_Inverted, Dn as HEADER_VARIABLES, wt as LibreDwg, yt as createModule, At as dwgCodePageToEncoding, Wn as dwgVersions }; //# sourceMappingURL=index-C365l3i9.js.map