Can't find the correct syntax in scripting

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

Moderator: andrew

Post Reply
CVH
Full Member
Posts: 83
Joined: Wed Sep 27, 2017 4:17 pm
Location: Belgium; Antwerp

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

User avatar
andrew
Site Admin
Posts: 6187
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
Full Member
Posts: 83
Joined: Wed Sep 27, 2017 4:17 pm
Location: Belgium; Antwerp

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: 6187
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 Developers and Contributors”