explode text from within a library script

Use this forum to ask questions about how to do things in QCAD.

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files and screenshots.

Post one question per topic.

Post Reply
ventosus
Registered Member
Posts: 1
Joined: Tue Dec 17, 2013 7:21 pm

explode text from within a library script

Post by ventosus » Tue Dec 17, 2013 7:30 pm

- I create some text entity in a library script.
- Now I'd like to explode it immediately in the script, too.

How do i access/call the explode tool from within a script?
var txt = new RTextEntity(doc, new RTextData(new RVector(0, 0), new RVector(x, y), 8.0, 8.0, RS.VAlignTop, RS.HAlignCenter, RS.LeftToRight, RS.Exact, 1.0, "MYTEXT", "Berenika", true, false, 0, true));
op.addObject(txt, false);
//explode???

BastelFritz
Active Member
Posts: 25
Joined: Sun Apr 07, 2019 7:30 pm

Re: explode text from within a library script

Post by BastelFritz » Wed Apr 10, 2019 8:48 pm

I have the same question; added some text with:
text=addSimpleText("Example", 0.0,0.0, 1.5, 0.0, "Arial", RS.VAlignBase, RS.HAlignCenter, false, false);

Now I'd like to "explode" the text.
Via command line it is clear, but is it possible within a .js script, too? Should be, but I am new to this...

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

Re: explode text from within a library script

Post by andrew » Wed Apr 10, 2019 9:55 pm

You can explode selected entities using:

Code: Select all

Explode.explodeSelection(di);
Where "di" is your RDocumentInterface. Be sure to include "scripts/Modify/Explode/Explode.js" first.

BastelFritz
Active Member
Posts: 25
Joined: Sun Apr 07, 2019 7:30 pm

Re: explode text from within a library script

Post by BastelFritz » Thu Apr 11, 2019 6:38 am

Great, that helped.

Here the complete snipped for other beginners:

Code: Select all

include ("scripts/Modify/Explode/Explode.js");
text=addSimpleText("Example", 0.0,0.0, 1.5, 0.0, "Arial", RS.VAlignBase, RS.HAlignCenter, false, false);
di=getDocumentInterface()
di.selectEntity(text.getId(), true);
Explode.explodeSelection(di);
di.deselectAll();
Thank you for quick response!

Post Reply

Return to “QCAD 'How Do I' Questions”