INVENTOR文件是一种由AutoDesk公司开发的三维设计软件Inventor创建的文件格式。该文件格式使用的扩展名为.ipt(零件)、.asm(装配体)、.idw(制图)、.dwg(AutoCAD兼容格式)。该文件格式广泛应用于3D设计、工程图形、计算机辅助制造(CAM)等领域。
INVENTOR文件采用二进制方式存储,并由多个模块组成。每个模块都由唯一的标识符和文件头部进行标识。其中,标识符可以定位到文件中的特定模块。下面介绍各个模块的作用:
文件头是INVENTOR文件的开始部分,存储了文件的版本、文件属性、文件结构信息等。文件头结构如下:
#define INVBINARYFILEHDRSIG "**This is an Autodesk Inventor binary file**\r\n"
#define INVHISTORYVERSION 0x0D0A312E
struct InvFileHeader
{
UByte signature[60]; // INVBINARYFILEHDRSIG
int version; // INVENTOR Binary format version - to catch legacy files
int reserved; // reserved for later use
UByte uuid[16]; // Unique ID for the file, GUID
int schemaDataSize; // Size of the associated XML file with schema data
int sessionDataSize; // Size of the SessionData section at end of this file
};
元数据是INVENTOR文件中存储元素属性的部分。它包括了对象名称、对象类型、物理位置、材料属性等,与对象的生命周期密切相关。元数据包含的信息可以被用于许多应用程序,如版本控制、进程管理、元数据搜索、安全等。下面是元数据的结构:
struct IVPersistStreamPersistData
{
bool wrapItem;
bool wrapDocument;
bool wrapObjects;
bool wrapComponents;
bool wrapParentAssembly;
bool includeIUnits;
bool includeIParameters;
bool includeGraphics;
int filterCategories[200];
bool useAdvancedSelection;
bool useAdvancedFeatureRecognition;
bool includeAllConstraints;
bool listConstraints;
bool includeOrigins;
bool includeReferencedDocuments;
bool includeEdges;
bool lightenShadows;
bool preserveResolution;
bool includeSketches;
bool generateSnapCones;
bool applyElevationMapping;
bool includeAnnotations;
bool includeAdvancedSheetReps;
bool generateThumbnail;
bool forceDisplayHiddenComponents;
bool appendSavedDate;
bool generateSectionViews;
bool generateAuxiliaryViews;
bool useCustomSectionLine;
bool include3DAnnotations;
bool generateSimplifiedRepresentations;
bool generateSimplifiedDrawingViews;
TCHAR customSectionLine[256];
int customSectionLineOrientation;
int customSectionLineWeight;
bool closeResult;
bool showModelAnnotations;
bool filterInvisibleComponents;
bool ignoreSketchConstraints;
bool surfaceBodiesAsSolids;
bool includeAuthorInfo;
bool includeCameraInfo;
bool includeReferences;
int multibandBitDepth;
bool saveIntoPart;
bool includeAlteredObjects;
bool includeForeignObjects;
};
几何体是INVENTOR文件的主要部分,也是最大的模块。它存储了3D模型中的所有几何形状,包括零件、装配体和图形。每个几何体都有属性,如位置、方向、大小、材料、颜色等。下面是几何体的结构:
struct IVGeomInstance
{
IVGeometicType geomType;
IVGeometryType geometryType;
IVMajorType majorType;
bool isVirtual;
int subtype;
bool isEmbedded;
IVMat33 matrix;
IVDescriptor bodyDescriptor;
IVDescriptor materialDescriptor;
IVDescriptor transformDescriptor;
IVDescriptor partDescriptor;
IVDescriptor modelDescriptor;
IVDescriptor featureDescriptor;
IVDescriptor routingDescriptor;
IVDescriptor featureSeqDescriptor;
IVDrawingName drawingName;
int numberOfShapes;
int shapeOffset;
UInt32Vector shapeHashes;
float boundingBoxMin[3];
float boundingBoxMax[3];
};
历史记录是文件中用于操作和重构几何体的关键记录,包括创建、变形、切割和组合等。这些操作会更改元数据和几何体,也会在文件中记录一段历史记录。下面是历史记录的结构:
struct IVHistScenario
{
IVHistObjectRecs recs;
IVHistScenarioState undoState;
IVHistScenarioState redoState;
IVHistScenarioId scenarioId;
bool basedOnImport;
bool useAdvancedSelection;
};
INVENTOR文件格式有相关的官方规范文档可供参考,AutoDesk也提供了一些开发工具和SDK。有关更多详细信息,请参阅以下链接:
INVENTOR二进制文件格式规范:https://autodesk.i.lithium.com/t5/image/serverpage/image-id/68758iB6FBCC5CA035A8E?v=1.0
AutoDesk官方文档:https://knowledge.autodesk.com/support/inventor-products/getting-started?_ga=2.225222588.431544794.1630674026-2055239485.1630674026
INVENTOR文件格式的示例文件可以从AutoDesk官方网站上下载获得,以下是一个简单的.ipt示例文件:
MYDOC.ipt
<ObjectInfo>
<ObjectType>Part</ObjectType>
<Translation>0 0 0</Translation>
<Rotation>0 0 0</Rotation>
<Visible>1</Visible>
<Color>255 0 0</Color>
</ObjectInfo>
<Parameters>
<Length>100</Length>
<Width>50</Width>
<Height>25</Height>
</Parameters>
<Geometry>
<Box>
<Length> $(Length) </Length>
<Width> $(Width) </Width>
<Height> $(Height) </Height>
<Center> 0 0 0 </Center>
</Box>
</Geometry>
该文件定义了一个名称为MYDOC的零件,它的长度是100,宽度是50,高度是25,并且为红色。几何形状是一个长方体,位于原点。