Hi friends. Specially dear Andrew!
I need to create a new tool that extracts properties of selected object(x, y, width, height) and processes them and displays a result to the user. For example suppose this scenario :
1-User selects a car in his map ( opened in QCad )
2-User selects my tool(from toolbar or menubar)
3-(Here is the problem!) My tool gets x,y,w,h of selected car and produces a result based on these four numbers and displays a message box to the user.
I can create new tool (I've read this : http://www.qcad.org/doc/qcad/3.0/develo ... _tool.html!) But first of all I want to know whether it's possible doing such a task completely in Qt(processing the x,y,w,h numbers)?
Second I need a start point for how to do this task?
Thank you guys!
Creating a tool that gets coordinates of selected object
Moderator: andrew
Forum rules
Always indicate your operating system and QCAD version.
Attach drawing files, scripts and screenshots.
Post one question per topic.
Always indicate your operating system and QCAD version.
Attach drawing files, scripts and screenshots.
Post one question per topic.
Re: Creating a tool that gets coordinates of selected object
You might want to have a look at the bounding box example which is very similar:
scripts/Misc/Examples/DrawExamples/ExDrawBoundingBox/ExDrawBoundingBox.js
(Online at: https://github.com/qcad/qcad/blob/maste ... dingBox.js)
This is no problem with the Qt / QCAD script environment.
Displaying a message box is as simple as:
scripts/Misc/Examples/DrawExamples/ExDrawBoundingBox/ExDrawBoundingBox.js
(Online at: https://github.com/qcad/qcad/blob/maste ... dingBox.js)
This is no problem with the Qt / QCAD script environment.
Displaying a message box is as simple as:
QMessageBox.information(null, "Title", "My message...");
Re: Creating a tool that gets coordinates of selected object
Really thank you ! But how can I create a tool completely in Qt.That's my problem, not showing a message . Is there any tutorial?
Re: Creating a tool that gets coordinates of selected object
Got It ! I can use every Qt classes in my .js file. Is it true?
Re: Creating a tool that gets coordinates of selected object
Yes. Almost the entire Qt API is available in scripts. If you need help or an example for a particular class, just search through the scripts directory of QCAD - chances are there is already a script showing how to use that class somewhere.
Re: Creating a tool that gets coordinates of selected object
I've never seen someone conscientious like you Andrew. Again thank you.