简体   繁体   English

Parasolid v30的新嵌入式架构格式?

[英]New embedded schema format for Parasolid v30?

I have two binary Parasolid files from v30 (internal modeller string is 3000226, schema string is SCH_3000226_30000_13006). 我有两个来自v30的二进制Parasolid文件(内部建模器字符串为3000226,架构字符串为SCH_3000226_30000_13006)。 In it, the embedded schema information for older types is as defined in the latest copy I have of the Parasolid XT Format Reference. 在其中,较旧类型的嵌入式架构信息如我拥有的《 Parasolid XT格式参考》的最新副本中所定义。 However, for entity type 204 (introduced after the 28101 schema) the embedded schema format is completely different. 但是,对于实体类型204(在28101模式之后引入),嵌入式模式格式完全不同。 Luckily, it has a lot of strings in it, so it is pretty easy to reverse engineer the basic form of it: 幸运的是,其中包含很多字符串,因此对它的基本形式进行反向工程非常容易:

unsigned byte: number of fields
short string: nodename
short string: description

then for each field
  short string: fieldname
  five bytes: maybe somehow correspond to <transmit 1/0> <node class> <n_elements> ?
  byte: (field) type

byte: possibly <variable 1/0> ?

Then the entity proper begins as expected. 然后,实体会按预期开始。

The problem is that this seems like a workable parsing of the binary version, but without knowing what the five mystery bytes actually correspond to, I don't know how to implement support for this in a Parasolid text file. 问题在于,这似乎是二进制版本的可行解析,但是在不知道五个神秘字节实际对应的情况下,我不知道如何在Parasolid文本文件中实现对此的支持。 It might be two short ints and an unsigned char, might be one 4-byte int and an unsigned char. 它可能是两个short整数和一个无符号字符,可能是一个4字节int和一个无符号字符。 Heck, since in both examples I have the first three mystery bytes are zero, there might even be a string of some sort in there, which just happens to be 0 length in this case, in which case, of course, it's not really five bytes always but just happens to be five bytes in my two examples. 哎呀,因为在两个示例中我的前三个神秘字节均为零,所以甚至可能还有某种字符串,在这种情况下长度恰好为0,在这种情况下,当然不是五个个字节,但在我的两个示例中恰好是五个字节。

Does anyone have an idea what is going on in the mystery bytes? 是否有人知道神秘字节中发生了什么?

Also, I'm assuming this scheme will be active for entity types 204 and up. 另外,我假设此方案对于实体类型204及更高版本将是有效的。 What I don't know about is entity type 203. I don't believe I've ever seen a Parasolid file with that type in it. 我不知道是实体类型203。我不相信我曾经见过带有该类型的Parasolid文件。

(Also, does anyone have any insight as to why they would make a non-backward compatible change to a feature intended solely to support backwards compatibility?) (此外,是否有人对为什么仅对支持向后兼容性的功能进行非向后兼容更改有任何见解?)

Stumbled onto the answer for own question. 偶然发现了自己的问题的答案。 It turns out I should have realized they wouldn't make a backwards incompatible change here. 事实证明,我应该意识到他们不会在这里进行向后不兼容的更改。 In fact what I ran into is documented, just very badly. 实际上,我所遇到的情况非常糟糕。 Here are the rules as I have figured them out: 这是我已经弄清楚的规则:

This "new" form of embedded schema is what you get when you have an entity type which is not present in Schema 13006. (So types 185 and up, I believe.) In that case, the format is 当您拥有模式13006中不存在的实体类型时,将获得这种嵌入式模式的“新”形式。(我相信类型为185及以上)。在这种情况下,格式为

unsigned byte: number of fields
short string: type name (aka nodename)
short string: description

then for each field
    short string: name
    short int: ptr_class
    positive integer: n_elts
    if ptr_class == 0
        short string: type
    if n_elts == 2
        logical: xmt_code

Notes: 笔记:

  • The "for each field" code is the same as the field data incorporated in the insert and append (I and A) codes in the edit sequence version. “对于每个字段”代码与合并在编辑序列版本中的插入和附加(I和A)代码中的字段数据相同。
  • The "positive integer" type in binary is like the pointer index type, where it is 2 bytes if the integer is less than 32767 and 4 bytes otherwise. 二进制中的“正整数”类型类似于指针索引类型,如果整数小于32767,则为2个字节,否则为4个字节。 Since I've never seen a value higher than 2 here, and cannot begin to imagine what sort of entity would have a fixed size and more than 2 to the 15th elements, I haven't implemented this yet. 由于我从未在此处看到大于2的值,并且无法开始想象哪种类型的实体将具有固定的大小且大于2到第15个元素,因此我尚未实现。
  • Also this n_elts field appears to be one greater than the equivalent n_elements field found in the standard schema. 同样,此n_elts字段似乎比标准架构中的等效n_elements字段大一。 (This is clearly visible in the n_elts == 2 test above -- according to the file format spec, it should be n_elts == 1, but that does NOT work at all.) (这在上面的n_elts == 2测试中清晰可见-根据文件格式规范,它应该为n_elts == 1,但这根本不起作用。)

Minus my caveats here, these basic instructions do appear in the 2016 version of the file format, on page 14. However, the formatting is completely broken, as can be seen comparing with the older V15 version of the document -- there should be two levels of bullet points, not one, and the first row of the table was mistakenly turned into a header! 请注意,这些基本说明确实出现在文件格式的2016版中(第14页)。但是,与旧版V15版本的文档相比,格式已被完全破坏了-应该有两个级别的项目符号点,而不是一个,表的第一行被错误地转换为标题!

I've also got to note that while this has my code working for entity type 204, I appear to have never seen a new type in an X_T file before, which is why I never noticed this hole in my code. 我还必须注意,尽管这使我的代码适用于实体类型204,但以前似乎从未在X_T文件中看到新类型,这就是为什么我从未在代码中注意到此漏洞。 So I cannot vouch that this works in the general case -- all I know for sure is it works in the type 204 case. 因此,我不能保证这在一般情况下都可以工作-我只知道可以在204型情况下使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM