Esempio n. 1
0
        private bool BoxInfoToSolItem(List <ContentItem> contentItems, Vector3D offset, SolItem solItem, Transform3D transform, out int index, out BoxPosition pos)
        {
            index = 0;
            pos   = BoxPosition.Zero;

            BoxProperties b = IDToBox(solItem.Id);

            if (null != b)
            {
                try
                {
                    index = (int)solItem.Id;
                    pos   = BoxPosition.FromPositionDimension(
                        new Vector3D((double)solItem.X, (double)solItem.Y, (double)solItem.Z),
                        new Vector3D((double)solItem.BX, (double)solItem.BY, (double)solItem.BZ),
                        new Vector3D((double)solItem.DimX, (double)solItem.DimY, (double)solItem.DimZ)
                        );
                    pos = pos.Transform(Transform3D.Translation(offset) * transform);

                    return(true);
                }
                catch (Exception ex)
                {
                    _log.Error(ex.Message);
                }
            }
            return(false);
        }
Esempio n. 2
0
        private bool CuboidToSolItem(List <ContentItem> contentItems, Vector3D offset, Cuboid cuboid, out int index, out BoxPosition pos)
        {
            index = 0;
            pos   = BoxPosition.Zero;
            try
            {
                index = int.Parse(cuboid.Tag.ToString());
                BoxProperties bProperties = IDToBox((uint)index);

                pos = BoxPosition.FromPositionDimension(
                    new Vector3D((double)cuboid.X, (double)cuboid.Y, (double)cuboid.Z) + offset,
                    new Vector3D((double)cuboid.Width, (double)cuboid.Height, (double)cuboid.Depth),
                    new Vector3D(bProperties.Length, bProperties.Width, bProperties.Height)
                    );
                return(true);
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message);
            }
            return(false);
        }
Esempio n. 3
0
        private bool CuboidToSolItem(List <ContentItem> contentItems, Vector3D offset, Cuboid cuboid, out int index, out BoxPosition pos)
        {
            index = 0;
            pos   = BoxPosition.Zero;

            if (cuboid.Tag is BoxProperties bProperties)
            {
                try
                {
                    index = contentItems.FindIndex(ci => ci.MatchDimensions((double)cuboid.Width, (double)cuboid.Depth, (double)cuboid.Height));
                    pos   = BoxPosition.FromPositionDimension(
                        new Vector3D((double)cuboid.X, (double)cuboid.Y, (double)cuboid.Z) + offset,
                        new Vector3D((double)cuboid.Width, (double)cuboid.Height, (double)cuboid.Depth),
                        new Vector3D(bProperties.Length, bProperties.Width, bProperties.Height)
                        );
                    return(true);
                }
                catch (Exception ex)
                {
                    _log.Error(ex.Message);
                }
            }
            return(false);
        }