Go to the documentation of this file.
12 #include <Draw/DrawStyle.h>
13 #include <Draw/Texture2.h>
14 #include <Draw/Texture2Transform.h>
80 void setTexture(
const Draw::Texture2& tex,
int faceIndex = -1);
82 const Draw::Texture2& crossTexture,
83 const Draw::Texture2Transform& lengthTextureTrsf = Draw::Texture2Transform(),
84 const Draw::Texture2Transform& crossTextureTrsf = Draw::Texture2Transform());
96 int aTranslationId = -1);
101 int aTranslationId = -1);
104 double aDefaultValue,
107 int aTranslationId = -1);
112 int aTranslationId = -1);
118 int aTranslationId = -1);
124 int aTranslationId = -1);
130 int aTranslationId = -1);
132 std::shared_ptr<OpenLxApp::Property>
getProperty(
const std::string& aName)
const;
172 template <
typename T>
173 bool registerPythonClass(std::shared_ptr<T> aObject,
const std::string& aClassName,
const std::string& aParentClassName)
175 if (aClassName ==
"" || aParentClassName ==
"")
178 auto pco = mProduct->getPythonClassObject();
181 std::cout <<
"Already registered!" << std::endl;
184 if (pythonProductVersion < aObject->getScriptVersion())
186 aObject->convertFromOldVersion(pythonProductVersion);
200 QString(
"Cannot register Python Script. \nGlobalId = %1\nDid you forget to "
201 "add\n\ndoc.registerPythonScript(Base.GlobalId(\"{<aGloballyUniqueId>}\") \n\nto your "
202 "Lexocad Python Script?\nSee https://www.guidgenerator.com to generate a GlobalId.")
208 if (!pythonScriptObject)
211 App::GetApplication().getQApplicationName(),
212 QString(
"Cannot get the registered Script.\nGlobalId = %1").arg(QString::fromStdWString(scriptId.
toString().
c_str())));
217 auto classId = aObject->getGlobalClassId();
218 if (classId.isNull())
221 QString(
"Cannot register Python class. \nGlobalId = %1\nDid you forget to add\n\ndef "
222 "getGlobalClassId(self):\n return Base.GlobalId(\"{<aGloballyUniqueId>}\") \n\nto "
223 "your Lexocad Python class?\nSee https://www.guidgenerator.com to generate a GlobalId.")
224 .arg(QString::fromStdWString(classId.toString().c_str())));
232 QFileInfo fi(QString::fromStdWString(fileName.c_str()));
233 QString baseName = fi.completeBaseName();
234 if (baseName.contains(
' '))
237 QString(
"Cannot import '%1'.\nWhitespaces in names are not allowed.").arg(baseName));
246 if (regClass->className.getValue() != thisClassName)
249 App::GetApplication().getQApplicationName(),
250 QString(
"Cannot register Python class. \nThe GlobalId is already registered with a different class (%1)")
251 .arg(QString::fromStdWString(regClass->className.getValue().c_str())));
254 mProduct->setPythonClassObject(regClass);
257 const int pythonProductVersion = aObject->getScriptVersion();
264 std::cout <<
"First register" << std::endl;
267 mProduct->setPythonClassObject(pythonClassObject);
268 pythonClassObject->className.setValue(thisClassName);
269 pythonClassObject->classId.setValue(classId);
270 pythonClassObject->superClassName.setValue(superClassName);
273 pythonClassObject->pythonScriptObject.setValue(pythonScriptObject);
274 pythonClassObject->standardManipulatorPolicy.setValue(
281 const int pythonProductVersion = aObject->getScriptVersion();
289 template <
typename T>
295 switch (aReason.
msgId)
307 aObject->onScaling(vec, pnt);
317 App::Product* mProduct =
nullptr;
Definition: ActiveScript.h:10
void setOglMaterial(const Draw::OglMaterial &mat, int faceIndex=-1)
void setTransform(const Geom::Trsf &t)
void setLocalAxes(const Geom::Dir &zHeight, const Geom::Dir &xLength)
std::shared_ptr< PropertyInteger > registerPropertyInteger(const std::string &aName, int aDefaultValue, Property::Visible aVisible=Property::VISIBLE, Property::Editable aEditable=Property::EDITABLE, int aTranslationId=-1)
void setPythonProductVersion(int pythonProductVersion) const
Keeps the information about a Python class like class name, the super class etc. Also keeps the infor...
Definition: PythonClassObject.h:25
bool registerPythonClass(std::shared_ptr< T > aObject, const std::string &aClassName, const std::string &aParentClassName)
Definition: ProductImpl.h:173
Base::String toString() const
std::shared_ptr< PropertyUser > getPropertyUser(const std::string &aName) const
virtual void showMessageBoxError(const QString &title, const QString &text, QWidget *parent=nullptr, bool silent=false)
@ TRANSLATEZENABLEDW
Definition: StandardManipulatorPolicy.h:23
Definition: CoreDocument.h:269
Base::String getPropertyHeader() const
@ TRANSLATEYENABLED
Definition: StandardManipulatorPolicy.h:21
void setLocalPlacement(const Geom::Ax2 &pos)
void setEmissiveColor(const Base::Color &aCol)
Base::String getPropertyGroupName() const
std::vector< Base::String > getPropertySetNames() const
void rotate(const Geom::Ax1 &axis, double angle, Geom::CoordSpace aCoordSpace=Geom::CoordSpace::WCS)
pConstShape getShape() const
std::shared_ptr< PropertySet > getPropertySetByName(const Base::String &aName) const
const wchar_t * c_str() const
Returns wchar_t array.
Definition: String.h:62
int getPythonProductVersion() const
bool isRegisteredProperty(const std::string &aName) const
std::shared_ptr< PropertyEnum > getPropertyEnum(const std::string &aName) const
std::shared_ptr< PropertyString > getPropertyString(const std::string &aName) const
void setReflectiveColor(const Base::Color &aCol)
void setVisible(bool onoff)
Definition: DocObjectObserver.h:9
Defines a non-persistent vector in 3D space.
Definition: Vec.h:41
Definition: GlobalId.h:28
void translateAfterScaled(const Geom::Vec &aVec, const Geom::Pnt &aScaleBasePnt)
@ HIGHLIGHT
Definition: StandardManipulatorPolicy.h:25
Base::String toString(bool *ok=0) const
LX_CORE_EXPORT Base::String getCurrentScriptFilePath()
Geom::Bnd_Box getBoundingBox() const
std::shared_ptr< PropertyBool > getPropertyBool(const std::string &aName) const
@ TRANSLATEZENABLEDH
Definition: StandardManipulatorPolicy.h:24
std::shared_ptr< OpenLxApp::Property > getProperty(const std::string &aName) const
void setStandardManipulatorPolicy(const Core::StandardManipulatorPolicy &aPolicy)
MessageId msgId
Definition: DocObjectObserver.h:17
Geom::Trsf getGeometryToWorldTransform() const
Definition: StandardManipulatorPolicy.h:8
void translate(const Geom::Vec &aVec, Geom::CoordSpace aCoordSpace=Geom::CoordSpace::WCS)
Editable
Definition: Property.h:36
std::shared_ptr< PropertyInteger > getPropertyInteger(const std::string &aName) const
void onChange(std::shared_ptr< T > aObject, Core::DocObject *aCaller, const Core::DocObjectObserverMsg &aReason)
Definition: ProductImpl.h:290
std::shared_ptr< Topo::Shape const > pConstShape
Definition: Variant.h:65
void setDrawStyle(const Draw::DrawStyle &ds)
@ TRANSLATEXENABLED
Definition: StandardManipulatorPolicy.h:20
Geom::Vec toVector(bool *ok=0) const
static bool registerClass(PythonClassObject *aClassObject)
Core::Variant value2
Definition: DocObjectObserver.h:19
void setShininess(int aVal)
Definition: DocObject.h:54
void setDiffuseColor(const Base::Color &aCol)
static PythonClassObject * getRegisteredClass(const Base::GlobalId &aClassId)
std::shared_ptr< Geometry > getGeometry() const
Core::Variant value1
Definition: DocObjectObserver.h:18
std::shared_ptr< PropertyString > registerPropertyString(const std::string &aName, const Base::String &aDefaultValue, Property::Visible aVisible=Property::VISIBLE, Property::Editable aEditable=Property::EDITABLE, int aTranslationId=-1)
std::shared_ptr< PropertyEnum > registerPropertyEnum(const std::string &aName, int aDefaultValue, Property::Visible aVisible=Property::VISIBLE, Property::Editable aEditable=Property::EDITABLE, int aTranslationId=-1)
void setLengthAndCrossTexture(const Draw::Texture2 &lengthTexture, const Draw::Texture2 &crossTexture, const Draw::Texture2Transform &lengthTextureTrsf=Draw::Texture2Transform(), const Draw::Texture2Transform &crossTextureTrsf=Draw::Texture2Transform())
Defines a non-persistent 3D Cartesian point.
Definition: Pnt.h:44
Draw::DrawStyle getDrawStyle() const
Geom::Trsf getLocalToWorldTransform() const
CoordSpace
Definition: GeomEnums.h:6
static CoreApplication * instance(void)
Returns the Singleton.
LX_CORE_EXPORT Base::GlobalId getCurrentScriptId()
pConstShape getLocalShape() const
static PythonScriptObject * getRegisteredScript(const Base::GlobalId &aScriptPath)
std::shared_ptr< PropertyDouble > registerPropertyDouble(const std::string &aName, double aDefaultValue, Property::Visible aVisible=Property::VISIBLE, Property::Editable aEditable=Property::EDITABLE, int aTranslationId=-1)
void setPropertyHeader(const Base::String &aDefaultName, int aTranslationId)
@ TRANSLATEZENABLEDL
Definition: StandardManipulatorPolicy.h:22
std::shared_ptr< PropertyButton > registerPropertyButton(const std::string &aName, Property::Visible aVisible=Property::VISIBLE, Property::Editable aEditable=Property::EDITABLE, int aTranslationId=-1)
void setSpecularColor(const Base::Color &aCol)
virtual bool setGeometry(std::shared_ptr< Geometry > geo)
long getPositionNb() const
std::shared_ptr< Document > getDocument() const
Geom::Pnt toPoint(bool *ok=0) const
void setPropertyGroupName(const Base::String &aDefaultName, int aTranslationId)
std::shared_ptr< PropertyDouble > getPropertyDouble(const std::string &aName) const
@ SHOWBBOX
Definition: StandardManipulatorPolicy.h:11
std::vector< std::shared_ptr< PropertyUser > > getPropertyUser() const
Visible
Definition: Property.h:30
T * createObject()
Definition: CoreDocument.h:538
Geom::Ax2 getLocalPlacement() const
Draw::OglMaterial getOglMaterial() const
std::shared_ptr< PropertyColor > registerPropertyColor(const std::string &aName, const Base::Color &aDefaultValue, Property::Visible aVisible=Property::VISIBLE, Property::Editable aEditable=Property::EDITABLE, int aTranslationId=-1)
ProductImpl implements the Product behavior of an object. This is used in Product and SubElement.
Definition: ProductImpl.h:41
std::shared_ptr< PropertyButton > getPropertyButton(const std::string &aName) const
LX_BASE_EXPORT Base::MessageBase & Message()
Definition: Message.h:153
Definition: PythonScriptObject.h:11
Geom::Trsf getTransform() const
std::map< std::string, std::shared_ptr< Property > > getPropertyMap() const
ProductImpl(App::Product *aProduct)
std::shared_ptr< PropertyColor > getPropertyColor(const std::string &aName) const
void setAmbientColor(const Base::Color &aCol)
A Utf-16 (windows) or ucs4 (unix) encoded string class.
Definition: String.h:18
@ VISIBLE
Definition: Property.h:32
bool getLocalAxes(Geom::Ax2 &localAxes)
@ EDITABLE
Definition: Property.h:38
void setPositionNb(long value)
std::shared_ptr< PropertyBool > registerPropertyBool(const std::string &aName, bool aDefaultValue, Property::Visible aVisible=Property::VISIBLE, Property::Editable aEditable=Property::EDITABLE, int aTranslationId=-1)
void setLineWidth(float width)
static constexpr double linear_Resolution()
Definition: Precision.h:23
void setTransparency(int aVal)
void setTexture(const Draw::Texture2 &tex, int faceIndex=-1)