Exemplo n.º 1
0
        public PolyfaceMesh(IEnumerable <PolyfaceMeshVertex> vertexes, IEnumerable <PolyfaceMeshFace> faces)
            : base(EntityType.PolyfaceMesh, DxfObjectCode.Polyline)
        {
            this.flags = PolylinetypeFlags.PolyfaceMesh;
            if (vertexes == null)
            {
                throw new ArgumentNullException(nameof(vertexes));
            }
            this.vertexes = new List <PolyfaceMeshVertex>(vertexes);
            if (this.vertexes.Count < 3)
            {
                throw new ArgumentOutOfRangeException(nameof(vertexes), this.vertexes.Count, "The polyface mesh faces list requires at least three points.");
            }

            if (faces == null)
            {
                throw new ArgumentNullException(nameof(vertexes));
            }
            this.faces = new List <PolyfaceMeshFace>(faces);
            if (this.faces.Count < 1)
            {
                throw new ArgumentOutOfRangeException(nameof(vertexes), this.faces.Count, "The polyface mesh faces list requires at least one face.");
            }

            this.endSequence = new EndSequence(this);
        }
Exemplo n.º 2
0
        public Insert(Block block, Vector3 position)
            : base(EntityType.Insert, DxfObjectCode.Insert)
        {
            if (block == null)
            {
                throw new ArgumentNullException(nameof(block));
            }

            this.block       = block;
            this.position    = position;
            this.scale       = new Vector3(1.0);
            this.rotation    = 0.0;
            this.endSequence = new EndSequence(this);

            List <Attribute> atts = new List <Attribute>(block.AttributeDefinitions.Count);

            foreach (AttributeDefinition attdef in block.AttributeDefinitions.Values)
            {
                Attribute att = new Attribute(attdef)
                {
                    Position = attdef.Position + this.position - this.block.Origin,
                    Owner    = this
                };
                atts.Add(att);
            }

            this.attributes = new AttributeCollection(atts);
        }
Exemplo n.º 3
0
        public Polyline(IEnumerable <PolylineVertex> vertexes, bool isClosed)
            : base(EntityType.Polyline, DxfObjectCode.Polyline)
        {
            if (vertexes == null)
            {
                throw new ArgumentNullException(nameof(vertexes));
            }
            this.vertexes = new ObservableCollection <PolylineVertex>();
            this.vertexes.BeforeAddItem    += this.Vertexes_BeforeAddItem;
            this.vertexes.AddItem          += this.Vertexes_AddItem;
            this.vertexes.BeforeRemoveItem += this.Vertexes_BeforeRemoveItem;
            this.vertexes.RemoveItem       += this.Vertexes_RemoveItem;

            this.vertexes.AddRange(vertexes);

            this.flags       = isClosed ? PolylinetypeFlags.ClosedPolylineOrClosedPolygonMeshInM | PolylinetypeFlags.Polyline3D : PolylinetypeFlags.Polyline3D;
            this.smoothType  = PolylineSmoothType.NoSmooth;
            this.endSequence = new EndSequence(this);
        }
Exemplo n.º 4
0
        internal Insert(List <Attribute> attributes)
            : base(EntityType.Insert, DxfObjectCode.Insert)
        {
            if (attributes == null)
            {
                throw new ArgumentNullException(nameof(attributes));
            }
            this.attributes = new AttributeCollection(attributes);
            foreach (Attribute att in this.attributes)
            {
                if (att.Owner != null)
                {
                    throw new ArgumentException("The attributes list contains at least an attribute that already has an owner.", nameof(attributes));
                }
                att.Owner = this;
            }

            this.endSequence = new EndSequence(this);
        }