Page 1 of 1

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

Posted: Sat Aug 03, 2019 7:43 pm
by CVH
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

Re: Can't find the correct syntax in scripting

Posted: Sun Aug 04, 2019 9:53 pm
by andrew
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

Re: Can't find the correct syntax in scripting

Posted: Mon Aug 05, 2019 6:03 am
by CVH
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.

Re: Can't find the correct syntax in scripting

Posted: Tue Aug 06, 2019 9:24 am
by andrew
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.