Create a rectangle around object?
Can this be done in illustrator scripting??
http://coreldraw.com/forums/t/35280.aspx
creating a rectangle around selected object or objects and set margins...
Regards
Martin
Can this be done in illustrator scripting??
http://coreldraw.com/forums/t/35280.aspx
creating a rectangle around selected object or objects and set margins...
Regards
Martin
Hallo martin_Cahill,
My English is not the best, because of that in German.
Grundsätzlich sind sich VBA und Javascript sehr ähnlich. Versuche die folgende Funktion mit den VBA-Äquivalenten zu vergleichen. Learning by doing ![]()
function makeRect() {
if (selection.length == 0) {
alert("Kein Objekt …");
return;
}else{
if (selection.length > 1) {
alert("Zu viele Objekte …");
return;
}else{
var myDoc = app.activeDocument;
var Sel = myDoc.selection
var SelVB = Sel[0].visibleBounds;
var dMarg = 28.3464567;
var Links = SelVB[0];
var Oben = SelVB[1];
var SelBreite = (SelVB[2] - SelVB[0]);
var SelHoehe = (SelVB[1] - SelVB[3]);
var newCMYK = new CMYKColor();
newCMYK.cyan = 100;
newCMYK.magenta = 0;
newCMYK.yellow = 0;
newCMYK.black = 0;
var myGroup =myDoc.groupItems.add();
Sel[0].move(myGroup, ElementPlacement.PLACEATBEGINNING);
var MargBox = myDoc.pathItems.rectangle(Oben+dMarg, Links-dMarg, SelBreite+2*dMarg, SelHoehe+2*dMarg);
MargBox.stroked = true;
MargBox.strokeWidth = 10;
//MargBox.filled = false;
MargBox.fillColor = newCMYK;
MargBox.move(myGroup, ElementPlacement.PLACEATEND);
}
}
}
Hilft dir das weiter?
Viel Spass noch.
![]()
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.