[SOLVED] Can't find the correct syntax in scripting

Discussion forum for C++ and script developers who are using the QCAD development platform or who are looking to contribute to QCAD (translations, documentation, etc).

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files, scripts and screenshots.

Post one question per topic.

Post Reply
CVH
Premier Member
Posts: 3416
Joined: Wed Sep 27, 2017 4:17 pm

[SOLVED] Can't find the correct syntax in scripting

Post by CVH » Sat Aug 03, 2019 7:43 pm

Andrew, I am missing out on the syntax in scripting
I got two similar ones I can't get to work.

with entity = document.queryEntity(id);
with isArcEntity(entity) = true
How to properly address
math...Rarc...isFullCircle as Boolean

with isPolylineEntity(entity) = true
How to properly address
math...RPolyline...bulges as Qlist
math...RPolyline...getBulges as Qlist
math...RPolyline...hasArcSegments as Boolean

And/or what to explicitly include?
Compiled there are fairly no scripts present as file.
(Plain Wininstaller)

Regards
Last edited by CVH on Mon Dec 21, 2020 6:25 am, edited 1 time in total.

User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

Re: Can't find the correct syntax in scripting

Post by andrew » Sun Aug 04, 2019 9:53 pm

CVH wrote:
Sat Aug 03, 2019 7:43 pm
with entity = document.queryEntity(id);
with isArcEntity(entity) = true
How to properly address
math...Rarc...isFullCircle as Boolean

Code: Select all

var arcShape = entity.castToShape();
if (arcShape.isFullCircle()) {
    ...
}
CVH wrote:
Sat Aug 03, 2019 7:43 pm
with isPolylineEntity(entity) = true
How to properly address
math...RPolyline...bulges as Qlist
math...RPolyline...getBulges as Qlist
math...RPolyline...hasArcSegments as Boolean

Code: Select all

var plShape = entity.castToShape();
var bulges = plShape.getBulges();
if (plShape.hasArcSegments()) {
    ...
}
CVH wrote:
Sat Aug 03, 2019 7:43 pm
Compiled there are fairly no scripts present as file.
You might want to search our github repository or download the scripts as sources:
https://github.com/qcad/qcad

CVH
Premier Member
Posts: 3416
Joined: Wed Sep 27, 2017 4:17 pm

Re: Can't find the correct syntax in scripting

Post by CVH » Mon Aug 05, 2019 6:03 am

Thanks Andrew,
I found the 'shape method' myself but it solves not all of my concerns.

Looking at a shape signature
eg
[code]RArc(RShape(address: "0x15d2a2b0"), center: RVector(56.2438, -22.9758,.....[/code]

Does Qcad rely on the turncated numbers or on the underlying full precision?

I have a copy of the scripts as source for reference.
Not allways the latest but its only to peek at.
The script folder under Win/Progarms is as it comes, fairly empty, and is kept so.
For numberToString() I had to add sprint.js because this trows an error without.

User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

Re: Can't find the correct syntax in scripting

Post by andrew » Tue Aug 06, 2019 9:24 am

CVH wrote:
Mon Aug 05, 2019 6:03 am
Does Qcad rely on the turncated numbers?
No, that's just the output of the object's toString() method.

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”