xBimTeam / XbimGeometry

XbimGeometry contains the CLR interop libraries and the c++ engine used to compute the 3D geometry of models.
https://xbimteam.github.io/
Other
260 stars 131 forks source link

We need to get shellpoints of any Building elements. #481

Closed ashvinisawantsofttechengr closed 5 months ago

ashvinisawantsofttechengr commented 5 months ago

We are replacing hoops by xbim. In hoops we are getting shellpoints of building component. We want to get same shellpoints using XBim. This is shellpoints function which is using hoops.

public void GetShellPointsOfComponent1(HPS.Component component, out List shellPoint, out List faces, out List<int[]> FacesSet) { FacesSet = new List<int[]>();

        shellPoint = new List<HPS.Point>();
        faces = new List<int>();
        HPS.Component[] children = component.GetAllSubcomponents(HPS.Component.ComponentType.ExchangeRIPolyBRepModel);
        if (children.Length > 0)
        {
            //HPS.Component[] SubComponents = children[0].GetSubcomponents();
            foreach (HPS.Component comp in children)
            {
                HPS.Component.ComponentType compType = comp.GetComponentType();

                if (compType == HPS.Component.ComponentType.ExchangeRIPolyBRepModel)
                {
                    Exchange.Component exchComponent = new Exchange.Component(comp);
                    HPS.Key[] keys = exchComponent.GetKeys();
                    Stack<HPS.Component> componentStack2 = new Stack<HPS.Component>();
                    componentStack2.Push(comp);
                    HPS.ComponentPath ComponentPath2 = new ComponentPath(componentStack2.ToArray());
                    KeyPath[] paths = ComponentPath2.GetKeyPaths();
                    MatrixKit mKit;
                    paths[0].ShowNetModellingMatrix(out mKit);

                    foreach (HPS.Key key in keys)
                    {

                        if (key.Type() == HPS.Type.SegmentKey)
                        {
                            HPS.SegmentKey segKey = new HPS.SegmentKey(key);
                            SearchResults searchResults;
                            ulong numResults = segKey.Find(Search.Type.Geometry, // searching for geometry
                            Search.Space.SegmentOnly, // within all this segment
                            out searchResults);
                            HPS.SearchResultsIterator it = searchResults.GetIterator();

                            while (it.IsValid())
                            {
                                HPS.Key geomKey = it.GetItem();
                                HPS.Type geomKeyType = geomKey.Type();
                                if (geomKeyType == HPS.Type.ShellKey)
                                {
                                    HPS.ShellKey shellKey = new ShellKey(geomKey);
                                    HPS.Point[] shellPoints;
                                    bool res = shellKey.ShowPoints(out shellPoints);
                                    //if (res == false)
                                    //    MessageBox.Show("NO shell points");

                                    int k = 0;
                                    foreach (HPS.Point point in shellPoints)
                                    {
                                        HPS.Point temp = mKit.Transform(point);
                                        shellPoints[k] = temp;
                                        k++;
                                    }
                                    shellPoint.AddRange(shellPoints.ToList());

                                }
                                it.Next();
                            }

                        }
                    }
                }
            }
        }
    }
martin1cerny commented 5 months ago

Hi @ashvinisawantsofttechengr , I'm glad you have chosen the Toolkit as a replacement for Hoops. However, I'm sorry, but this kind of question is way beyond the level of support we can provide here on GitHub. It is not an issue with the Toolkit, or IFC implementation. If you need an assistance with mapping Hoops features and functionality to xbim Toolkit, we can provide commercial support for that. Feel free to get in touch if you are interested.