Modify polyline

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
RR88
Full Member
Posts: 51
Joined: Sun Apr 29, 2018 7:04 am
Location: Leinefelde

Modify polyline

Post by RR88 » Sat Jan 04, 2020 9:14 pm

How can I modify a line within a polyline? I tried it this way:

Code: Select all

var op = new RModifyObjectsOperation(false);

var itm = doc.queryEntity(12),
    sh = itm.castToShape();

if (isPolylineShape(sh)
    && !sh.isGeometricallyClosed()) {

    var _sh = sh.getFirstSegment();

    if (isLineShape(_sh)) {
        _sh.setStartPoint(new RVector(1, 2));
        op.addObject(itm, false);
    }
}

di.applyOperation(op);
There is no change. Any ideas?
Arch Linux, QCad 3.22.0 Prof.

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

Re: Modify polyline

Post by CVH » Sat Jan 04, 2020 10:10 pm

Hi,

Really, you know its entity 12? :wink:

What I see you do, is picking the first polyline segment and alter its startpoint.

Then you have a separated clone of the segment of the RLine type or RArc type.
Where you altered the startpoint from.

IMHO this is no ModifyObjectsOperation. :oops:

For that you have to alter the vertex of the poly and trow that as an Operation.

In my own words....
Edit: I am still a Novice... :|

Cheers,
CVH
Last edited by CVH on Sat Jan 04, 2020 11:09 pm, edited 2 times in total.

RR88
Full Member
Posts: 51
Joined: Sun Apr 29, 2018 7:04 am
Location: Leinefelde

Re: Modify polyline

Post by RR88 » Sat Jan 04, 2020 10:50 pm

I'm not a novice!!!!
The 12 was just for the snippet.

Oh it's a clone. Makes sense. :D
Arch Linux, QCad 3.22.0 Prof.

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

Re: Modify polyline

Post by CVH » Sat Jan 04, 2020 11:08 pm

RR88 wrote:
Sat Jan 04, 2020 10:50 pm
I'm not a novice!!!!
sorry, I meant: I am still...

CVH

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”