コード例 #1
0
        DXFAttr(39, default=0, optional=True),
        "extrusion":
        DXFAttr(
            210,
            xtype=XType.point3d,
            default=Z_AXIS,
            optional=True,
            validator=validator.is_not_null_vector,
            fixer=RETURN_DEFAULT,
        ),
    },
)

acdb_circle_group_codes = group_code_mapping(acdb_circle)
merged_circle_group_codes = merge_group_code_mappings(
    acdb_entity_group_codes,
    acdb_circle_group_codes  # type: ignore
)


@register_entity
class Circle(DXFGraphic):
    """DXF CIRCLE entity"""

    DXFTYPE = "CIRCLE"
    DXFATTRIBS = DXFAttributes(base_class, acdb_entity, acdb_circle)
    MERGED_GROUP_CODES = merged_circle_group_codes

    def load_dxf_attribs(self,
                         processor: SubclassProcessor = None
                         ) -> "DXFNamespace":
        """Loading interface. (internal API)"""
コード例 #2
0
            210,
            xtype=XType.point3d,
            default=Z_AXIS,
            optional=True,
            validator=validator.is_not_null_vector,
            fixer=RETURN_DEFAULT,
        ),
        # angle of the x-axis for the UCS in effect when the point was drawn;
        # used when PDMODE is nonzero:
        "angle":
        DXFAttr(50, default=0, optional=True),
    },
)
acdb_point_group_codes = group_code_mapping(acdb_point)
merged_point_group_codes = merge_group_code_mappings(
    acdb_entity_group_codes,
    acdb_point_group_codes  # type: ignore
)


@register_entity
class Point(DXFGraphic):
    """DXF POINT entity"""

    DXFTYPE = "POINT"
    DXFATTRIBS = DXFAttributes(base_class, acdb_entity, acdb_point)

    def load_dxf_attribs(self,
                         processor: SubclassProcessor = None
                         ) -> "DXFNamespace":
        """Loading interface. (internal API)"""
        # bypass DXFGraphic, loading proxy graphic is skipped!
コード例 #3
0
ファイル: insert.py プロジェクト: Rahulghuge94/ezdxf
        "row_spacing":
        DXFAttr(45, default=0, optional=True),
        "extrusion":
        DXFAttr(
            210,
            xtype=XType.point3d,
            default=Z_AXIS,
            optional=True,
            validator=validator.is_not_null_vector,
            fixer=RETURN_DEFAULT,
        ),
    },
)
acdb_block_reference_group_codes = group_code_mapping(acdb_block_reference)
merged_insert_group_codes = merge_group_code_mappings(
    acdb_entity_group_codes,
    acdb_block_reference_group_codes  # type: ignore
)

NON_ORTHO_MSG = ("INSERT entity can not represent a non-orthogonal target "
                 "coordinate system.")

# Notes to SEQEND:
#
# The INSERT entity requires only a SEQEND if ATTRIB entities are attached.
#  So a loaded INSERT could have a missing SEQEND.
#
# A bounded INSERT needs a SEQEND to be valid at export if there are attached
# ATTRIB entities, but the LinkedEntities.post_bind_hook() method creates
# always a new SEQEND after binding the INSERT entity to a document.
#
# Nonetheless the Insert.add_attrib() method also creates a requires SEQEND if
コード例 #4
0
        "oblique":
        DXFAttr(51, default=0, optional=True),
        "extrusion":
        DXFAttr(
            210,
            xtype=XType.point3d,
            default=Z_AXIS,
            optional=True,
            validator=validator.is_not_null_vector,
            fixer=RETURN_DEFAULT,
        ),
    },
)
acdb_shape_group_codes = group_code_mapping(acdb_shape)
merged_shape_group_codes = merge_group_code_mappings(
    acdb_entity_group_codes,
    acdb_shape_group_codes  # type: ignore
)


@register_entity
class Shape(DXFGraphic):
    """DXF SHAPE entity"""

    DXFTYPE = "SHAPE"
    DXFATTRIBS = DXFAttributes(base_class, acdb_entity, acdb_shape)

    def load_dxf_attribs(self,
                         processor: SubclassProcessor = None
                         ) -> "DXFNamespace":
        """Loading interface. (internal API)"""
        # bypass DXFGraphic, loading proxy graphic is skipped!
コード例 #5
0
        "thickness":
        DXFAttr(39, default=0, optional=True),
        "extrusion":
        DXFAttr(
            210,
            xtype=XType.point3d,
            default=Z_AXIS,
            optional=True,
            validator=validator.is_not_null_vector,
            fixer=RETURN_DEFAULT,
        ),
    },
)
acdb_polyline_group_codes = group_code_mapping(acdb_polyline, ignore=(66, ))
merged_polyline_group_codes = merge_group_code_mappings(
    acdb_entity_group_codes,
    acdb_polyline_group_codes  # type: ignore
)

# Notes to SEQEND:
# todo: A loaded entity should have a valid SEQEND, a POLYLINE without vertices
#  makes no sense - has to be tested
#
# A virtual POLYLINE does not need a SEQEND, because it can not be exported,
# therefore the SEQEND entity should not be created in the
# DXFEntity.post_new_hook() method.
#
# A bounded POLYLINE needs a SEQEND to valid at export, therefore the
# LinkedEntities.post_bind_hook() method creates a new SEQEND after binding
# the entity to a document if needed.

コード例 #6
0
        "thickness":
        DXFAttr(39, default=0, optional=True),
        "extrusion":
        DXFAttr(
            210,
            xtype=XType.point3d,
            default=Z_AXIS,
            optional=True,
            validator=validator.is_not_null_vector,
            fixer=RETURN_DEFAULT,
        ),
    },
)
acdb_trace_group_codes = group_code_mapping(acdb_trace)
merged_trace_group_codes = merge_group_code_mappings(
    acdb_entity_group_codes,
    acdb_trace_group_codes  # type: ignore
)


class _Base(DXFGraphic):
    def __getitem__(self, num):
        return self.dxf.get(VERTEXNAMES[num])

    def __setitem__(self, num, value):
        return self.dxf.set(VERTEXNAMES[num], value)


@register_entity
class Solid(_Base):
    """DXF SHAPE entity"""
コード例 #7
0
        ),
        # Ratio has to be in the range from 1e-6 to 1, but could be negative:
        "ratio":
        DXFAttr(
            40, default=MAX_RATIO, validator=is_valid_ratio, fixer=fix_ratio),
        # Start of ellipse, this value is 0.0 for a full ellipse:
        "start_param":
        DXFAttr(41, default=0),
        # End of ellipse, this value is 2*pi for a full ellipse:
        "end_param":
        DXFAttr(42, default=math.tau),
    },
)
acdb_ellipse_group_code = group_code_mapping(acdb_ellipse)
merged_ellipse_group_codes = merge_group_code_mappings(
    acdb_entity_group_codes,
    acdb_ellipse_group_code  # type: ignore
)

HALF_PI = math.pi / 2.0


@register_entity
class Ellipse(DXFGraphic):
    """DXF ELLIPSE entity"""

    DXFTYPE = "ELLIPSE"
    DXFATTRIBS = DXFAttributes(base_class, acdb_entity, acdb_ellipse)
    MIN_DXF_VERSION_FOR_EXPORT = DXF2000

    def load_dxf_attribs(self,
                         processor: SubclassProcessor = None
コード例 #8
0
ファイル: arc.py プロジェクト: Rahulghuge94/ezdxf
if TYPE_CHECKING:
    from ezdxf.eztypes import TagWriter, Vec3

__all__ = ["Arc"]

acdb_arc = DefSubclass(
    "AcDbArc",
    {
        "start_angle": DXFAttr(50, default=0),
        "end_angle": DXFAttr(51, default=360),
    },
)

acdb_arc_group_codes = group_code_mapping(acdb_arc)
merged_arc_group_codes = merge_group_code_mappings(merged_circle_group_codes,
                                                   acdb_arc_group_codes)


@register_entity
class Arc(Circle):
    """DXF ARC entity"""

    DXFTYPE = "ARC"
    DXFATTRIBS = DXFAttributes(base_class, acdb_entity, acdb_circle, acdb_arc)
    MERGED_GROUP_CODES = merged_arc_group_codes

    def export_entity(self, tagwriter: "TagWriter") -> None:
        """Export entity specific data as DXF tags."""
        super().export_entity(tagwriter)
        # AcDbEntity export is done by parent class
        # AcDbCircle export is done by parent class