Skip to content

Commit a63a782

Browse files
committed
[CEXT-Dan#346] added Entity.transparency
1 parent c80a724 commit a63a782

File tree

5 files changed

+46
-10
lines changed

5 files changed

+46
-10
lines changed

PyRxCore/PyCmColorBase.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ void makePyCmTransparencyWrapper()
9494
#endif
9595
.def("isClear", &AcCmTransparency::isClear, DS.ARGS())
9696
.def("isSolid", &AcCmTransparency::isSolid, DS.ARGS())
97+
.def("setMethod", &AcCmTransparency::setMethod, DS.ARGS({"method: PyDb.TransparencyMethod"}))
9798
//operators
9899
.def("__eq__", &AcCmTransparency::operator==)
99100
.def("__ne__", &AcCmTransparency::operator!=)

PyRxCore/PyDbEntity.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ void makePyDbEntityWrapper()
3939
.def("setColorIndex", &PyDbEntity::setColorIndex1)
4040
.def("setColorIndex", &PyDbEntity::setColorIndex2, DS.ARGS({ "clr: int", "dosubents : bool=True" }, 4350))
4141
.def("entityColor", &PyDbEntity::entityColor, DS.ARGS(4302))
42+
.def("transparency", &PyDbEntity::transparency, DS.ARGS())
43+
.def("setTransparency", &PyDbEntity::setTransparency1)
44+
.def("setTransparency", &PyDbEntity::setTransparency2, DS.ARGS({ "transparency: PyDb.Transparency", "dosubents : bool=True" }, 4361))
4245
.def("layer", &PyDbEntity::layer, DS.ARGS(4327))
4346
.def("layerId", &PyDbEntity::layerId, DS.ARGS(4328))
4447
.def("setLayer", &PyDbEntity::setLayer1)
@@ -235,7 +238,12 @@ AcCmTransparency PyDbEntity::transparency() const
235238
return impObj()->transparency();
236239
}
237240

238-
void PyDbEntity::setTransparency(const AcCmTransparency& trans, Adesk::Boolean doSubents /*= true*/) const
241+
void PyDbEntity::setTransparency1(const AcCmTransparency& trans) const
242+
{
243+
return PyThrowBadEs(impObj()->setTransparency(trans, true));
244+
}
245+
246+
void PyDbEntity::setTransparency2(const AcCmTransparency& trans, Adesk::Boolean doSubents) const
239247
{
240248
return PyThrowBadEs(impObj()->setTransparency(trans, doSubents));
241249
}

PyRxCore/PyDbEntity.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ class PyDbEntity : public PyDbObject
2929
void setColorIndex2(Adesk::UInt16 color, Adesk::Boolean doSubents) const;
3030
AcCmEntityColor entityColor() const;
3131
AcCmTransparency transparency() const;
32-
void setTransparency(const AcCmTransparency& trans, Adesk::Boolean doSubents) const;
32+
void setTransparency1(const AcCmTransparency& trans) const;
33+
void setTransparency2(const AcCmTransparency& trans, Adesk::Boolean doSubents) const;
3334
std::string layer() const;
3435
PyDbObjectId layerId() const;
3536
void setLayer1(const std::string& newVal) const;

pyrx/PyDb.pyi

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6537,6 +6537,12 @@ class Database(PyRx.RxObject):
65376537
Returns the object context manager.
65386538
"""
65396539
@overload
6540+
def objectIdArray(self, desc: PyRx.RxClass = PyDb.DbObject, /) -> ObjectIdArray: ...
6541+
@overload
6542+
def objectIdArray(self, descList: list[PyRx.RxClass], /) -> ObjectIdArray: ...
6543+
@overload
6544+
def objectIdArray(self, *args) -> ObjectIdArray: ...
6545+
@overload
65406546
def objectIds(self, desc: PyRx.RxClass = PyDb.DbObject, /) -> list[PyDb.ObjectId]: ...
65416547
@overload
65426548
def objectIds(self, descList: list[PyRx.RxClass], /) -> list[PyDb.ObjectId]: ...
@@ -12105,6 +12111,18 @@ class Entity(PyDb.DbObject):
1210512111
"""
1210612112
Sets the property indicating whether this entity can receive shadows.
1210712113
"""
12114+
def setTransparency(self, transparency: PyDb.Transparency, dosubents: bool = True, /) -> None:
12115+
"""
12116+
This function sets the transparency value for the entity. If the entity owns subentities
12117+
and is Adesk::kTrue, the transparency change is applied to the subentities as well. The
12118+
only built-in entities for which kTrue has an effect are AcDb2dPolyline, AcDb3dPolyline,
12119+
AcDbPolyFaceMesh, and AcDbPolygonMesh. If this function is overridden and wishes to set the
12120+
color of the entity, the override must call AcDbEntity::setTransparency(), passing on the
12121+
trans and doSubents arguments. It is also possible for this function's implementation to
12122+
deal directly with any subentities and pass a doSubents value of Adesk::kFalse to
12123+
AcDbEntity::setTransparency(). If the transparency-setting operation is successful, the
12124+
function returns Acad::eOk. Return values for errors are up to the implementer.
12125+
"""
1210812126
def setVisibility(self, val: PyDb.Visibility, dosubents: bool = True, /) -> None:
1210912127
"""
1211012128
This method sets the visibility of an entity to the value specified by newVal. If the
@@ -12137,6 +12155,7 @@ class Entity(PyDb.DbObject):
1213712155
that have this restriction, it is recommended that Acad::eCannotScaleNonUniformly be
1213812156
returned.
1213912157
"""
12158+
def transparency(self, /) -> Transparency: ...
1214012159
def visibility(self, /) -> Visibility:
1214112160
"""
1214212161
This method returns the entity's current visibility state, either AcDb::kVisible or
@@ -25871,6 +25890,7 @@ class Transparency:
2587125890
def isSolid(self, /) -> bool: ...
2587225891
def setAlpha(self, alpha: int, /) -> None: ...
2587325892
def setAlphaPercent(self, alphaPercent: float, /) -> None: ...
25893+
def setMethod(self, method: PyDb.TransparencyMethod, /) -> None: ...
2587425894

2587525895
class TransparencyMethod(_BoostPythonEnum):
2587625896
kByLayer: ClassVar[Self] # 0

pyrx/PyEd.pyi

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,12 +1442,12 @@ class DragStyleType(_BoostPythonEnum):
14421442
class DrawJig:
14431443
def __init__(self, /) -> None: ...
14441444
def __reduce__(self, /) -> Any: ...
1445-
def acquireAngle(self, basePnt: PyGe.Point3d = ..., /) -> tuple[PyGe.DragStatus, float]: ...
1446-
def acquireDist(self, basePnt: PyGe.Point3d = ..., /) -> tuple[PyGe.DragStatus, float]: ...
1445+
def acquireAngle(self, basePnt: PyGe.Point3d = ..., /) -> tuple[PyEd.DragStatus, float]: ...
1446+
def acquireDist(self, basePnt: PyGe.Point3d = ..., /) -> tuple[PyEd.DragStatus, float]: ...
14471447
def acquirePoint(
14481448
self, basePnt: PyGe.Point3d = ..., /
1449-
) -> tuple[PyGe.DragStatus, PyGe.Point3d]: ...
1450-
def acquireString(self, /) -> tuple[PyGe.DragStatus, str]: ...
1449+
) -> tuple[PyEd.DragStatus, PyGe.Point3d]: ...
1450+
def acquireString(self, /) -> tuple[PyEd.DragStatus, str]: ...
14511451
@staticmethod
14521452
def className() -> str: ...
14531453
def dispPrompt(self, /) -> str: ...
@@ -2184,12 +2184,12 @@ class InputPointMonitorResult:
21842184
class Jig:
21852185
def __init__(self, entity: PyDb.Entity, /) -> None: ...
21862186
def __reduce__(self, /) -> Any: ...
2187-
def acquireAngle(self, basePnt: PyGe.Point3d = ..., /) -> tuple[PyGe.DragStatus, float]: ...
2188-
def acquireDist(self, basePnt: PyGe.Point3d = ..., /) -> tuple[PyGe.DragStatus, float]: ...
2187+
def acquireAngle(self, basePnt: PyGe.Point3d = ..., /) -> tuple[PyEd.DragStatus, float]: ...
2188+
def acquireDist(self, basePnt: PyGe.Point3d = ..., /) -> tuple[PyEd.DragStatus, float]: ...
21892189
def acquirePoint(
21902190
self, basePnt: PyGe.Point3d = ..., /
2191-
) -> tuple[PyGe.DragStatus, PyGe.Point3d]: ...
2192-
def acquireString(self, /) -> tuple[PyGe.DragStatus, str]: ...
2191+
) -> tuple[PyEd.DragStatus, PyGe.Point3d]: ...
2192+
def acquireString(self, /) -> tuple[PyEd.DragStatus, str]: ...
21932193
def append(self, /) -> PyDb.ObjectId: ...
21942194
@staticmethod
21952195
def className() -> str: ...
@@ -2262,6 +2262,12 @@ class SelectionSet:
22622262
def isInitialized(self, /) -> bool: ...
22632263
def keepAlive(self, flag: bool, /) -> None: ...
22642264
@overload
2265+
def objectIdArray(self, desc: PyRx.RxClass = PyDb.Entity, /) -> PyDb.ObjectIdArray: ...
2266+
@overload
2267+
def objectIdArray(self, descList: list[PyRx.RxClass], /) -> PyDb.ObjectIdArray: ...
2268+
@overload
2269+
def objectIdArray(self, *args) -> PyDb.ObjectIdArray: ...
2270+
@overload
22652271
def objectIds(self, desc: PyRx.RxClass = PyDb.Entity, /) -> list[PyDb.ObjectId]: ...
22662272
@overload
22672273
def objectIds(self, descList: list[PyRx.RxClass], /) -> list[PyDb.ObjectId]: ...

0 commit comments

Comments
 (0)