Page 1 of 1

explode text from within a library script

Posted: Tue Dec 17, 2013 7:30 pm
by ventosus
- 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???

Re: explode text from within a library script

Posted: Wed Apr 10, 2019 8:48 pm
by BastelFritz
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...

Re: explode text from within a library script

Posted: Wed Apr 10, 2019 9:55 pm
by andrew
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.

Re: explode text from within a library script

Posted: Thu Apr 11, 2019 6:38 am
by BastelFritz
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!