xBimTeam / XbimExchange

XbimExchange contains several COBie schemas and serialisation functions as well as the Model Validation library adopted by theNBS digital toolkit.
https://xbimteam.github.io/
Other
46 stars 41 forks source link

Get Position or Location . #16

Closed Ahmed-M-Ramadan closed 7 years ago

Ahmed-M-Ramadan commented 7 years ago

How can I get the position or location of any element like column from ifc file ?

I did that ...

//for ifc4
var model = IfcStore.Open(txt_path?.Text, new XbimEditorCredentials() { ApplicationDevelopersName = "A.Ramadan", EditorsOrganisationName = "iTi" }, true);
var all = model.Instances.OfType<IfcRectangleProfileDef>();
//all.Select(c => new { x = c.XDim, y = c.YDim,profileType = c.ProfileType }).ToList()
var points = all.Select(c => new { x = c.XDim, y = c.YDim }).ToList();
var data  = new BindingList<IfcColumn>(model.Instances.OfType<IfcColumn>().ToList());
grv_allProducts.DataSource = data;
var column = model.Instances.OfType<IfcColumn>();

var recProf = model.Instances.OfType<IfcRectangleProfileDef>();
IfcProfileTypeEnum area = (IfcProfileTypeEnum) recProf.FirstOrDefault().ProfileType;
var width = recProf.ElementAt(0).XDim;
var legnth = recProf.ElementAt(0).YDim;

var insertPoint = model.Instances.OfType<IfcCartesianPoint>();
//var axis2Plac2D = recProf.ElementAt(0).Position.Location;
var axis2Plac2D = recProf.FirstOrDefault().Position;
var position = recProf.FirstOrDefault().Position.Location.Coordinates;

but position return null !! I want to get the position of element from origin according to GLOBAL Axes. and thank you.

CBenghi commented 7 years ago

I'm having difficulties following the rationale of your code, also I think the repository of the question is wrong, you should be asking in Geometry.

In any case my advice is to look at the code in Xbim.WindowUI to see how to triangulate a model in Wpf; once you understand that you can probably reproduce the same behaviour in any environment of your choice.