コード例 #1
0
        /// <summary>
        /// Adds a textured sphere with the given material assigned to it
        /// </summary>
        /// <param name="material">The material to assign to the sphere</param>
        public void AddTexturedSphere(Material material)
        {
            // create sphere
            var sphere = new Sphere(Plane.WorldXY, 2);

            // add material to material table
            var index = AddMaterial(material);

            // add sphere to object table
            var id = _doc.Objects.AddSphere(sphere);

            // get sphere object
            var sphereObject = new ObjRef(id).Object();

            // assign material
            sphereObject.Attributes.MaterialSource = ObjectMaterialSource.MaterialFromObject;
            sphereObject.Attributes.MaterialIndex  = index;
            sphereObject.CommitChanges();
        }