Creo导出带颜色step的一些细节设置
STEP格式是指产品模型数据交换标准(Standard For The Exchange of Product Model Data)。1983年12月,国际标准化组织所属技术委员会TC184(工业自动化系统技术委员会)下的“产品模型数据外部表示”(External Representation of Product Model Data)分委会SC4所制定的国际统一CAD数据交换标准。
Creo导出step交换格式时,默认是不带颜色的。
手动操作
网上搜索可以看到有教程写“在Creo配置中添加step_export_format
选项并将其值设置为ap214_is
即可使得Creo导出的step文件包含颜色信息”。这句话总体是对的,不过实际上,step_export_format
选项可以包括很多值,各自有不同的效果,甚至还有一些貌似已经被启用且与选项旁边的帮助不一致,比如说ap214_cd
。
经过试验,如果要用gmsh 4.4
(OPEN CASCADE
内核)读Creo导出的stp文件并希望正确读到颜色,有几项配置可用,比如ap203_e2
、ap214_is
等,但需要符合以下条件:
- Creo软件配置编辑器不报错;
- 导出的step文件,用Creo软件读区有颜色信息;
- 导出step时,必须勾选“实体”和“基准曲面和点”选项。
自动操作
需要导出一些额外的不需要的东西,但可以确保想要的信息被包括了。
首先完成以上手动设置,保证手动操作没问题。
随后使用如下代码:
GeometryFlags surfaceFlag = pfcExport.GeometryFlags_Create(); surfaceFlag.SetAsSolids(true); InclusionFlags inclusionFlag = pfcExport.InclusionFlags_Create(); inclusionFlag.SetIncludeDatums(true); // I don't know why, but IncludeBlanked allows gmsh to read the color inclusionFlag.SetIncludeBlanked(true); STEP3DExportInstructions stepEI = pfcExport.STEP3DExportInstructions_Create(AssemblyConfiguration.EXPORT_ASM_FLAT_FILE, surfaceFlag); stepEI.SetIncludedEntities(inclusionFlag);