我正在尝试从我从建筑软件 Revit 中的 CAD 模型中提取的数据中序列化 gbXML 格式。对于 CAD 模型中的每个元素,我将几何图形提取为多边形环。因此,我使用了 Revit API 的类,当然这些类对我来说是未公开的。所以现在我想知道如何将所需的 XmlElements 添加为我无法访问的类的子类。这是我需要生成的架构:
<PlanarGeometry>
<PolyLoop>
<CartesianPoint>
<Coordinate>26.20337</Coordinate>
<Coordinate>15.67507</Coordinate>
<Coordinate>519</Coordinate>
</CartesianPoint>
这是我可以访问的类,其中 CurveLoop 是来自未公开的 Revit API 的类,我无法将任何标签放入其中。
[Serializable]
[XmlRoot("PlanarGeometry")]
public class PlanarGeometry
{
public CurveLoop OuterLoop { get; set; }
}
我没有找到能够编写非原始类型的 writer.writeXML 的任何方法。扩展方法可能有任何解决方案吗?我将非常感谢任何帮助!谢谢!