11 #include <Draw/DrawStyle.h> 12 #include <Draw/Texture2.h> 13 #include <Draw/Texture2Transform.h> 47 virtual bool setGeometry(std::shared_ptr<Geometry> geo);
65 void setOglMaterial(
const Draw::OglMaterial& mat,
int faceIndex = -1);
79 void setTexture(
const Draw::Texture2& tex,
int faceIndex = -1);
81 const Draw::Texture2& crossTexture,
82 const Draw::Texture2Transform& lengthTextureTrsf = Draw::Texture2Transform(),
83 const Draw::Texture2Transform& crossTextureTrsf = Draw::Texture2Transform());
95 int aTranslationId = -1);
100 int aTranslationId = -1);
103 double aDefaultValue,
106 int aTranslationId = -1);
111 int aTranslationId = -1);
117 int aTranslationId = -1);
123 int aTranslationId = -1);
129 int aTranslationId = -1);
131 std::shared_ptr<OpenLxApp::Property>
getProperty(
const std::string& aName)
const;
132 std::map<std::string, std::shared_ptr<Property>>
getPropertyMap()
const;
134 std::shared_ptr<PropertyEnum>
getPropertyEnum(
const std::string& aName)
const;
135 std::shared_ptr<PropertyDouble>
getPropertyDouble(
const std::string& aName)
const;
136 std::shared_ptr<PropertyButton>
getPropertyButton(
const std::string& aName)
const;
137 std::shared_ptr<PropertyBool>
getPropertyBool(
const std::string& aName)
const;
138 std::shared_ptr<PropertyString>
getPropertyString(
const std::string& aName)
const;
139 std::shared_ptr<PropertyColor>
getPropertyColor(
const std::string& aName)
const;
151 std::shared_ptr<PropertyUser>
getPropertyUser(
const std::string& aName)
const;
169 template <
typename T>
170 bool registerPythonClass(std::shared_ptr<T> aObject,
const std::string& aClassName,
const std::string& aParentClassName)
172 if (aClassName ==
"" || aParentClassName ==
"")
175 auto pco = mProduct->getPythonClassObject();
178 std::cout <<
"Already registered!" << std::endl;
190 QString(
"Cannot register Python Script. \nGlobalId = %1\nDid you forget to " 191 "add\n\ndoc.registerPythonScript(Base.GlobalId(\"{<aGloballyUniqueId>}\") \n\nto your " 192 "Lexocad Python Script?\nSee https://www.guidgenerator.com to generate a GlobalId.")
198 if (!pythonScriptObject)
201 App::GetApplication().getQApplicationName(),
202 QString(
"Cannot get the registered Script.\nGlobalId = %1").arg(QString::fromStdWString(scriptId.
toString().
c_str())));
207 auto classId = aObject->getGlobalClassId();
208 if (classId.isNull())
211 QString(
"Cannot register Python class. \nGlobalId = %1\nDid you forget to add\n\ndef " 212 "getGlobalClassId(self):\n return Base.GlobalId(\"{<aGloballyUniqueId>}\") \n\nto " 213 "your Lexocad Python class?\nSee https://www.guidgenerator.com to generate a GlobalId.")
214 .arg(QString::fromStdWString(classId.toString().c_str())));
223 QString baseName = fi.completeBaseName();
224 if (baseName.contains(
' '))
227 QString(
"Cannot import '%1'.\nWhitespaces in names are not allowed.").arg(baseName));
236 if (regClass->className.getValue() != thisClassName)
239 App::GetApplication().getQApplicationName(),
240 QString(
"Cannot register Python class. \nThe GlobalId is already registered with a different class (%1)")
241 .arg(QString::fromStdWString(regClass->className.getValue().c_str())));
244 mProduct->setPythonClassObject(regClass);
249 std::cout <<
"First register" << std::endl;
252 mProduct->setPythonClassObject(pythonClassObject);
253 pythonClassObject->className.setValue(thisClassName);
254 pythonClassObject->classId.setValue(classId);
255 pythonClassObject->superClassName.setValue(superClassName);
258 pythonClassObject->pythonScriptObject.setValue(pythonScriptObject);
259 pythonClassObject->standardManipulatorPolicy.setValue(
269 template <
typename T>
275 switch (aReason.
msgId)
287 aObject->onScaling(vec, pnt);
297 App::Product* mProduct =
nullptr;
void setStandardManipulatorPolicy(const Core::StandardManipulatorPolicy &aPolicy)
Geom::Trsf getGeometryToWorldTransform() const
void setReflectiveColor(const Base::Color &aCol)
Definition: StandardManipulatorPolicy.h:14
std::shared_ptr< PropertyInteger > getPropertyInteger(const std::string &aName) const
Core::Variant value1
Definition: DocObjectObserver.h:20
void translateAfterScaled(const Geom::Vec &aVec, const Geom::Pnt &aScaleBasePnt)
Definition: StandardManipulatorPolicy.h:26
std::shared_ptr< PropertyBool > registerPropertyBool(const std::string &aName, bool aDefaultValue, Property::Visible aVisible=Property::VISIBLE, Property::Editable aEditable=Property::EDITABLE, int aTranslationId=-1)
Base::String toString(bool *ok=0) const
void setAmbientColor(const Base::Color &aCol)
BASE_EXPORT Base::MessageBase & Message(void)
Definition: Message.h:162
Definition: Property.h:41
bool getLocalAxes(Geom::Ax2 &localAxes)
Defines a non-persistent 3D Cartesian point.
Definition: Pnt.h:42
Editable
Definition: Property.h:38
Definition: StandardManipulatorPolicy.h:24
void setDrawStyle(const Draw::DrawStyle &ds)
std::shared_ptr< Geometry > getGeometry() const
void setLocalPlacement(const Geom::Ax2 &pos)
Visible
Definition: Property.h:32
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)
static bool registerClass(PythonClassObject *aClassObject)
Definition: Property.h:35
Definition: StandardManipulatorPolicy.h:22
static const double linear_Resolution()
Definition: Precision.h:26
void setOglMaterial(const Draw::OglMaterial &mat, int faceIndex=-1)
ProductImpl implements the Product behavior of an object. This is used in Product and SubElement.
Definition: ProductImpl.h:39
static PythonClassObject * getRegisteredClass(const Base::GlobalId &aClassId)
bool isRegisteredProperty(const std::string &aName) const
Definition: StandardManipulatorPolicy.h:23
pConstShape getLocalShape() const
bool registerPythonClass(std::shared_ptr< T > aObject, const std::string &aClassName, const std::string &aParentClassName)
Definition: ProductImpl.h:170
Base::String getPropertyHeader() const
A Utf-16 (windows) or ucs4 (unix) encoded string class.
Definition: String.h:29
std::shared_ptr< PropertyEnum > registerPropertyEnum(const std::string &aName, int aDefaultValue, Property::Visible aVisible=Property::VISIBLE, Property::Editable aEditable=Property::EDITABLE, int aTranslationId=-1)
std::vector< Base::String > getPropertySetNames() const
void setSpecularColor(const Base::Color &aCol)
pConstShape getShape() const
std::shared_ptr< PropertySet > getPropertySetByName(const Base::String &aName) const
Draw::DrawStyle getDrawStyle() const
Definition: CoreDocument.h:197
std::shared_ptr< PropertyEnum > getPropertyEnum(const std::string &aName) const
std::shared_ptr< PropertyDouble > getPropertyDouble(const std::string &aName) const
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 translate(const Geom::Vec &aVec, Geom::CoordSpace aCoordSpace=Geom::CoordSpace::WCS)
void setVisible(bool onoff)
Definition: StandardManipulatorPolicy.h:25
void setPropertyHeader(const Base::String &aDefaultName, int aTranslationId)
void onChange(std::shared_ptr< T > aObject, Core::DocObject *aCaller, const Core::DocObjectObserverMsg &aReason)
Definition: ProductImpl.h:270
const wchar_t * c_str() const
Returns wchar_t array.
Definition: String.h:74
Definition: GlobalId.h:32
Definition: ActiveScript.h:9
static PythonScriptObject * getRegisteredScript(const Base::GlobalId &aScriptPath)
Definition: StandardManipulatorPolicy.h:9
Definition: PythonScriptObject.h:11
Geom::Vec toVector(bool *ok=0) const
std::shared_ptr< PropertyButton > getPropertyButton(const std::string &aName) const
Definition: StandardManipulatorPolicy.h:13
Keeps the information about a Python class like class name, the super class etc. Also keeps the infor...
Definition: PythonClassObject.h:25
std::vector< std::shared_ptr< PropertyUser > > getPropertyUser() const
Geom::Ax2 getLocalPlacement() const
Draw::OglMaterial getOglMaterial() const
Base::String toString() 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)
virtual void showMessageBoxError(const QString &title, const QString &text, QWidget *parent=nullptr, bool silent=false)
void setLengthAndCrossTexture(const Draw::Texture2 &lengthTexture, const Draw::Texture2 &crossTexture, const Draw::Texture2Transform &lengthTextureTrsf=Draw::Texture2Transform(), const Draw::Texture2Transform &crossTextureTrsf=Draw::Texture2Transform())
Geom::Trsf getTransform() const
void setShininess(int aVal)
ProductImpl(App::Product *aProduct)
Defines a non-persistent vector in 3D space.
Definition: Vec.h:45
Definition: StandardManipulatorPolicy.h:27
std::shared_ptr< PropertyColor > getPropertyColor(const std::string &aName) const
void setDiffuseColor(const Base::Color &aCol)
Geom::Pnt toPoint(bool *ok=0) const
void setTransparency(int aVal)
MessageId msgId
Definition: DocObjectObserver.h:19
CORE_EXPORT Base::String getCurrentScriptFilePath()
void setPositionNb(long value)
std::shared_ptr< PropertyButton > registerPropertyButton(const std::string &aName, Property::Visible aVisible=Property::VISIBLE, Property::Editable aEditable=Property::EDITABLE, int aTranslationId=-1)
void setTexture(const Draw::Texture2 &tex, int faceIndex=-1)
virtual bool setGeometry(std::shared_ptr< Geometry > geo)
void setLineWidth(float width)
std::shared_ptr< PropertyInteger > registerPropertyInteger(const std::string &aName, int aDefaultValue, Property::Visible aVisible=Property::VISIBLE, Property::Editable aEditable=Property::EDITABLE, int aTranslationId=-1)
std::shared_ptr< Document > getDocument() const
std::shared_ptr< Topo::Shape const > pConstShape
Definition: Variant.h:81
void setPropertyGroupName(const Base::String &aDefaultName, int aTranslationId)
Geom::Trsf getLocalToWorldTransform() const
void rotate(const Geom::Ax1 &axis, double angle, Geom::CoordSpace aCoordSpace=Geom::CoordSpace::WCS)
static CoreApplication * instance(void)
Returns the Singleton.
void setLocalAxes(const Geom::Dir &zHeight, const Geom::Dir &xLength)
void setTransform(const Geom::Trsf &t)
Base::String fileName
Definition: CoreDocument.h:161
long getPositionNb() const
std::shared_ptr< PropertyString > getPropertyString(const std::string &aName) const
void setEmissiveColor(const Base::Color &aCol)
Base::String getPropertyGroupName() const
CORE_EXPORT Base::GlobalId getCurrentScriptId()
Core::Variant value2
Definition: DocObjectObserver.h:21
Definition: DocObject.h:28
Geom::Bnd_Box getBoundingBox() const
std::shared_ptr< PropertyBool > getPropertyBool(const std::string &aName) const
CoordSpace
Definition: GeomEnums.h:8
Definition: DocObjectObserver.h:10
std::map< std::string, std::shared_ptr< Property > > getPropertyMap() const
std::shared_ptr< OpenLxApp::Property > getProperty(const std::string &aName) const