Comments (8)
The logic for cascading the deletion of elements is quite complicated to manage.
I think your best approach for reducing files is to build a new ones copying the elements of interest.
Does this seam to be an acceptable approach to your case? If so ping us again here.
There's no strong place where the community meets other than here. We'll have to work on this.
Best,
Claudio
from xbimessentials.
Thanks for the reply. I thought that might be the answer. I know about it being complicated to manage. That's pretty much why I was hoping you guys had already done it.
I agree with the copying relevant bits into a new model. I actually tried it using the XBimModel.InsertCopy() but I kept getting Assert errors. It looks like it is designed to do what I want though. Any suggestions?
_Model.CreateFrom(ifcFilename, xbimDbFilename, null, true, true);
var outputModel = new XbimModel();
using (var transaction = outputModel.BeginTransaction("add to representation"))
{
outputModel.InsertCopy(_Model.IfcProject, transaction);
outputModel.Validate(transaction.Modified(), Console.Out);
transaction.Commit();
}
from xbimessentials.
Apologies for the long wait, i'll be testing this in the next couple of days and come back to you.
from xbimessentials.
Work has commenced to migrate samples. See the develop branch for the latest state, now we support Ifc4 the remainder will be migrated over, any help greatly appreciated
from xbimessentials.
Shall we close this issue?
from xbimessentials.
Yup. No longer an issue
From: Martin Černý [mailto:[email protected]]
Sent: Wednesday, 16 March 2016 3:55 a.m.
To: xBimTeam/XbimEssentials [email protected]
Cc: jero [email protected]
Subject: Re: [XbimEssentials] Deleting / Removing stuff from the xbim model (#15)
Shall we close this issue?
—
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub:
#15 (comment)
from xbimessentials.
Hi Steve, Martin. Claudio,
I have similar problem, I want to filter walls and create the Spatial view.
I have used the following code, but it is not populating the tree (Only project number appears on the tree). Could you please help?
private void OpenIfcFile(object s, DoWorkEventArgs args)
{
var worker = s as BackgroundWorker;
var ifcFilename = args.Argument as string;
var model = new XbimModel();
var modelCopy = new XbimModel();
try
{
_temporaryXbimFileName = Path.GetTempFileName();
SetOpenedModelFileName(ifcFilename);
if (worker != null)
{
model.CreateFrom(ifcFilename, _temporaryXbimFileName, worker.ReportProgress, true);
string tempFileName = "";
modelCopy = XbimModel.CreateModel(tempFileName);
modelCopy.AutoAddOwnerHistory = false;
using (var txn = modelCopy.BeginTransaction())
{
var copied = new XbimInstanceHandleMap(model, modelCopy);
//modelCopy.InsertCopy(model.IfcProject, txn);
foreach (var item in model.Instances)
{
var ifctype = item.IfcType();
if (ifctype.IfcTypeEnum == IfcEntityNameEnum.IFCPROJECT ||
ifctype.IfcTypeEnum == IfcEntityNameEnum.IFCBUILDING ||
ifctype.IfcTypeEnum == IfcEntityNameEnum.IFCBUILDINGSTOREY ||
ifctype.IfcTypeEnum == IfcEntityNameEnum.IFCSITE ||
ifctype.IfcTypeEnum == IfcEntityNameEnum.IFCWALLSTANDARDCASE )
{
modelCopy.InsertCopy(item, copied, txn, false);
}
}
txn.Commit();
}
var context = new Xbim3DModelContext(modelCopy);//upgrade to new geometry represenation, uses the default 3D model
context.CreateContext(geomStorageType: XbimGeometryType.PolyhedronBinary, progDelegate: worker.ReportProgress, adjustWCS: false);
if (worker.CancellationPending) //if a cancellation has been requested then don't open the resulting file
{
try
{
model.Close();
if (File.Exists(_temporaryXbimFileName))
File.Delete(_temporaryXbimFileName); //tidy up;
_temporaryXbimFileName = null;
SetOpenedModelFileName(null);
}
catch (Exception ex)
{
Log.Error(ex.Message, ex);
}
return;
}
}
args.Result = modelCopy;
}
catch (Exception ex)
{
var sb = new StringBuilder();
sb.AppendLine("Error reading " + ifcFilename);
var indent = "\t";
while (ex != null)
{
sb.AppendLine(indent + ex.Message);
ex = ex.InnerException;
indent += "\t";
}
args.Result = new Exception(sb.ToString());
}
}
from xbimessentials.
Answered on #57
from xbimessentials.
Related Issues (20)
- PredefinedType in IIfcBuildingElementProxy not updatable HOT 3
- Non-canonical matrix-vector product HOT 3
- Model instances filter from interfaces HOT 10
- ManageOwnerHistory
- setting object colour for item exported from autocad HOT 1
- Support for IFC 4x3 HOT 4
- Reading STEP files HOT 2
- Provide means of accessing PredefinedType values from super-classes/interfaces
- Getting correct world coordinates of the element
- Geometry Store is empty on latest XbimEssentials 6.0.443-develop HOT 10
- Possibility of splitting IFC file into a few pieces HOT 2
- Exception ("Out of table cursors") from Xbim.IO.Esent-6.0.445 , While processing IFC files with size > 150 MB HOT 2
- Changing color of IfcBuildingElementProxy HOT 4
- how to create Space from objects such as wall, windows, doors, etc HOT 1
- IFCXml File with empty header throws exception HOT 2
- Windows, Doors, .. HOT 3
- Layers & Elements? HOT 1
- Move PDBs from NuGet packages to symbol packages
- IFC file with single backslash in STRING (HEADER:FILENAME) fails to load. HOT 5
- Getting sub components of site HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xbimessentials.