How To Highlight the different portions of wexbim files [Floors,Walls,etc]
umarone opened this issue · comments
A couple of different ways:
// Highlight all walls in the current highlight
viewer.setState(State.HIGHLIGHTED, ProductType.IFCWALL,1);
// Set Floor slabs to style 0
viewer.setStyle(0, ProductType.IFCSLAB,1);
For more examples see this demo: https://docs.xbim.net/examples/colourful-building.html
In the above example it looks like most objects in the mode are 'BuildingElementProxys' - where each item is given a Type. So in this case you'll need to identify the elements belonging to a type (e.g. DiningTable type), and then select the instances. e.g.
viewer.setState(State.HIGHLIGHTED, [instanceIds],1);
A couple of different ways:
// Highlight all walls in the current highlight viewer.setState(State.HIGHLIGHTED, ProductType.IFCWALL,1); // Set Floor slabs to style 0 viewer.setStyle(0, ProductType.IFCSLAB,1);
For more examples see this demo: https://docs.xbim.net/examples/colourful-building.html
In the above example it looks like most objects in the mode are 'BuildingElementProxys' - where each item is given a Type. So in this case you'll need to identify the elements belonging to a type (e.g. DiningTable type), and then select the instances. e.g.
viewer.setState(State.HIGHLIGHTED, [instanceIds],1);
Sir where is mean by InstanceIds Here
If you capture user interactions with the viewer, you will be getting instance IDs, so you can use them. Or, you might have server side code which will give you a set of entities based on some filtering criteria and you would use it as instance IDs array. These are the numbers you can see at the beginning of every line in IFC, or as EntityLabel
in the Toolkit code.
In my case entitylabel is 358095 for eachline but GlobalId is available instead which is unique for everyline.
moreover if you can paste some code, I will be thankful to you.
Server side:
[HttpGet]
[Route("/dining-tables")]
public IActionResult GetDiningTables()
{
var instanceIds = model.Instances
.Where<IIfcBuildingElementProxy>(p => p.IsTypedBy.Any(r => r.RelatingType.Name == "DiningTable"))
.Select(p => p.EntityLabel);
return JsonResult(instanceIds);
}
Client side:
viewer.setState(State.HIGHLIGHTED, [instanceIds],1);