示例#1
0
        internal Face(SU.FaceRef suFaceRef)
        {
            // Get its UVHelper for texture-mapping coordinates.

            UVHelper uvh = new UVHelper(suFaceRef);

            // Get the outer loop.

            EdgePointList edgePointList = new EdgePointList(suFaceRef);

            uvh.Assign(edgePointList);

            outerLoop = new Loop(edgePointList).edgePoints;

            // Get any inner loops.

            SU.FaceGetNumInnerLoops(suFaceRef, out long count);

            SU.LoopRef[] loopRefs = new SU.LoopRef[count];

            long len = count;

            SU.FaceGetInnerLoops(suFaceRef, len, loopRefs, out count);

            foreach (SU.LoopRef loopRef in loopRefs)
            {
                innerLoops.Add(
                    new Loop(new EdgePointList(loopRef)).edgePoints);
            }

            SU.MaterialRef suMaterialRef = new SU.MaterialRef();

            try
            {
                SU.FaceGetFrontMaterial(suFaceRef, suMaterialRef);

                SU.StringRef suStringRef = new SU.StringRef();
                SU.StringCreate(suStringRef);

                SU.MaterialGetNameLegacyBehavior(suMaterialRef, suStringRef);

                MaterialName = Convert.ToStringAndRelease(suStringRef);
            }
            catch (SketchUpException e)
            {
                if (e.ErrorCode == SU.ErrorNoData)
                {
                    // Not an error. It just has no material.
                }
                else
                {
                    throw;
                }
            }
        }
示例#2
0
        public UVHelper(SU.FaceRef faceRef)
        {
            SU.TextureWriterRef textureWriterRef = new SU.TextureWriterRef();

            uvHelperRef = new SU.UVHelperRef();

            SU.FaceGetUVHelper(
                faceRef,
                true,
                false,
                textureWriterRef,
                uvHelperRef);
        }
示例#3
0
        protected void UnpackEntities(SU.EntitiesRef entitiesRef)
        {
            // Get the faces.

            long count;

            SU.EntitiesGetNumFaces(entitiesRef, out count);

            SU.FaceRef[] faceRefs = new SU.FaceRef[count];

            long len = count;

            SU.EntitiesGetFaces(entitiesRef, len, faceRefs, out count);

            foreach (SU.FaceRef faceRef in faceRefs)
            {
                Faces.Add(new Face(faceRef));
            }

            // Get the groups.

            SU.EntitiesGetNumGroups(entitiesRef, out count);

            SU.GroupRef[] groupRefs = new SU.GroupRef[count];

            len = count;

            SU.EntitiesGetGroups(entitiesRef, len, groupRefs, out count);

            foreach (SU.GroupRef groupRef in groupRefs)
            {
                Groups.Add(new Group(groupRef));
            }

            // Get the instances.

            SU.EntitiesGetNumInstances(entitiesRef, out count);

            SU.ComponentInstanceRef[] instanceRefs = new SU.ComponentInstanceRef[count];

            len = count;

            SU.EntitiesGetInstances(entitiesRef, len, instanceRefs, out count);

            foreach (SU.ComponentInstanceRef instanceRef in instanceRefs)
            {
                Instances.Add(new CompInst(instanceRef));
            }
        }