修改IFC对象属性并写入IFC文件
修改IFC对象属性值并更新IFC文档内容。
public void updateIfcObjByIDIFC() throws IOException { IfcModel ifcModel = new IfcModel(); File stepFile = new File(fileName1); File stepFileW = new File(fileNameW1); if(stepFileW.exists()) { stepFileW.delete(); stepFileW.createNewFile(); } try { ifcModel.readStepFile(stepFile); IfcBeam ifcBeam1 = (IfcBeam) ifcModel.getIfcObjectByID(globalID); System.out.println("globalID:"+ifcBeam1.getGlobalId()+" name:"+ifcBeam1.getName()); STRING name1 = new STRING(); name1.setDecodedValue("AAAAAA"); IfcLabel ifcLabel1 = new IfcLabel(); ifcLabel1.setValue(name1); ifcBeam1.setName(ifcLabel1); System.out.println("globalID:"+ifcBeam1.getGlobalId()+" name:"+ifcBeam1.getName()); ifcModel.writeStepfile(stepFileW); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }
原始IFC
#1239648= IFCCARTESIANPOINT((250.,0.,-300.));
#1239650= IFCAXIS2PLACEMENT3D(#1239648,#11,#21);
#1239651= IFCEXTRUDEDAREASOLID(#1239647,#1239650,#19,1500.);
#1239652= IFCSTYLEDITEM(#1239651,(#12078),$);
#1239655= IFCSHAPEREPRESENTATION(#88,'Body','SweptSolid',(#1239651));
#1239657= IFCCARTESIANPOINT((2000.,0.));
#1239659= IFCPOLYLINE((#9,#1239657));
#1239661= IFCSHAPEREPRESENTATION(#86,'Axis','Curve2D',(#1239659));
#1239663= IFCPRODUCTDEFINITIONSHAPE($,$,(#1239661,#1239655));
#1239665= IFCBEAM('149QalMb16deCMONmZNEiV1',#41,'M_\X2\6DF751DD571F\X0\-\X2\77E95F626881\X0\:300 x 600mm:519271',$,'M_\X2\6DF751DD571F\X0\-\X2\77E95F626881\X0\:300 x 600mm:114370',#1239643,#1239663,'519271');
#1239668= IFCPROPERTYSINGLEVALUE('Span',$,IFCPOSITIVELENGTHMEASURE(2000.),$);
#1239669= IFCPROPERTYSET('149QalMb16deCMQfKZNEiV',#41,'Pset_BeamCommon',$,(#2128,#4846,#4847,#12215,#1239668));
#1239671= IFCRELDEFINESBYPROPERTIES('38Dv0DtGD2lefR$zwqV_F6',#41,$,$,(#1239665),#1239669);
#1239675= IFCPROPERTYSINGLEVALUE('\X2\5DE54F5C5E739762\X0\',$,IFCTEXT('\X2\68079AD8\X0\ : F2'),$);
#1239676= IFCPROPERTYSINGLEVALUE('\X2\526A5207957F5EA6\X0\',$,IFCLENGTHMEASURE(1500.),$);
#1239677= IFCPROPERTYSINGLEVALUE('\X2\4F5379EF\X0\',$,IFCVOLUMEMEASURE(0.27),$);
修改以后的IFC
#1239648= IFCCARTESIANPOINT((250.,0.,-300.));
#1239650= IFCAXIS2PLACEMENT3D(#1239648,#11,#21);
#1239651= IFCEXTRUDEDAREASOLID(#1239647,#1239650,#19,1500.);
#1239652= IFCSTYLEDITEM(#1239651,(#12078),$);
#1239655= IFCSHAPEREPRESENTATION(#88,'Body','SweptSolid',(#1239651));
#1239657= IFCCARTESIANPOINT((2000.,0.));
#1239659= IFCPOLYLINE((#9,#1239657));
#1239661= IFCSHAPEREPRESENTATION(#86,'Axis','Curve2D',(#1239659));
#1239663= IFCPRODUCTDEFINITIONSHAPE($,$,(#1239661,#1239655));
#1239665= IFCBEAM('149QalMb16deCMONmZNEiV1',#41,'M_\X2\6DF751DD571F\X0\-\X2\77E95F626881\X0\:300 x 600mm:519271',$,'M_\X2\6DF751DD571F\X0\-\X2\77E95F626881\X0\:300 x 600mm:114370',#1239643,#1239663,'519271');
#1239668= IFCPROPERTYSINGLEVALUE('Span',$,IFCPOSITIVELENGTHMEASURE(2000.),$);
#1239669= IFCPROPERTYSET('149QalMb16deCMQfKZNEiV',#41,'Pset_BeamCommon',$,(#2128,#4846,#4847,#12215,#1239668));
#1239671= IFCRELDEFINESBYPROPERTIES('38Dv0DtGD2lefR$zwqV_F6',#41,$,$,(#1239665),#1239669);
#1239675= IFCPROPERTYSINGLEVALUE('\X2\5DE54F5C5E739762\X0\',$,IFCTEXT('\X2\68079AD8\X0\ : F2'),$);
#1239676= IFCPROPERTYSINGLEVALUE('\X2\526A5207957F5EA6\X0\',$,IFCLENGTHMEASURE(1500.),$);
#1239677= IFCPROPERTYSINGLEVALUE('\X2\4F5379EF\X0\',$,IFCVOLUMEMEASURE(0.27),$);
#1239678= IFCPROPERTYSINGLEVALUE('\X2\957F5EA6\X0\',$,IFCLENGTHMEASURE(2000.),$);
#1239679= IFCPROPERTYSINGLEVALUE('\X2\976279EF\X0\',$,IFCAREAMEASURE(1.53),$);
#1239680= IFCPROPERTYSET('0axrEt8Mj7$x3$SQByRQMS',#41,'\X2\51764ED6\X0\',$,(#12244,#12245,#12246,#12247,#12248));
#1239682= IFCRELDEFINESBYPROPERTIES('0P6n1YdebA8eyWRmk_WoYA',#41,$,$,(#1239665),#1239680);
QQ 3087438119