Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Isolation mode

Guide ,
Apr 12, 2011 Apr 12, 2011

Anyone know how to get a doc in and out of this using JavaScript…?

TOPICS
Scripting
1.7K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Apr 12, 2011 Apr 12, 2011

The reference I find is to GroupItem and isIsolated as a boolean. Since the isolation mode is to work on items in a Group this makes sense. What were you looking to do?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Apr 12, 2011 Apr 12, 2011

Larry, this is in relation to a script posted by Carlos in the main Illustrator forum only last week or so… I had done a little work on this idea too although didn't get about to posting it… What I was trying to do was 'screen grab' well image capture actually a selection from within AI and use it as part of the scriptUI. I have asked before about 'isIsolated' and got no real answer… When you put an object in isolation in the GUI all other art gets dimmed and this captures with image capture too plus exporting… It would have been nicer if I could have done this in script too, placing the emphasis on the object in question. Then letting the focus go back to normal… Here are a couple of pics that may explain better what I mean…

Some junk and an isolated object…

Picture 5.png

Normal mode…

Picture 6.png

But is this what 'isIsolated' is even referring too? It's a property of all page items and I can set & get without errors yet nothing happens? I can post the script too if you need see what I was monkeying about with…? It works in my CS5 but this would be nice to know how to do if its possible?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 12, 2011 Apr 12, 2011

another broken property? isIsolated does nothing here either

Mark, what if you make a duplicate of your object, place it in a new layer and dim all other layers? I haven't tried it, do you think it would work?

EDIT: it works!!

Message was edited by: CarlosCanto

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Apr 12, 2011 Apr 12, 2011

Carlos, that was a thought but I think it may be too slow for what I had in mind… only wanted a little snap shot as png. A layer has 'dimPlacedImages' but that is images only… Changing all the possible layers opacity and restoring could turn out to be a big ask… depending on the art in question… Here is what I have at the moment the XY stuff is correct in CS5 I don't have CS4 to test with…? It should get you the co-ords relative to the active artboard. These are in edit boxes so you could cut and paste from them. The measures at present are based on the open doc's and it needs to be saved… I may change this to just script preference. Was also going to give an option on snapping the selected object or its parent artboard… Needs a bit more tinkering with yet…

#target illustrator #targetengine main /*////////////////////////////////////////////////                   *///////////////////////////////////////////////// selectionCoOrds(); function selectionCoOrds() {            if (app.documents.length > 0) {                           var doc = app.activeDocument;           var sel = doc.selection;                      if (sel.length == 1) {                                var aiFile = doc.fullName;                                var units = aiRulerUnits(aiFile);                                var ab = doc.artboards.getActiveArtboardIndex();                                ab++;                                sel = sel[0];                                //sel.isIsolated = true; No bloody working…                                var xy = doc.convertCoordinate(sel.position,                     CoordinateSystem.DOCUMENTCOORDINATESYSTEM,                     CoordinateSystem.ARTBOARDCOORDINATESYSTEM);                                     if (parseFloat(app.version) == 15) {xy[1] = -xy[1];}                                var x,y,w,h;                                switch (units) {                                     case 'cm' :                          x = roundToDP(xy[0]/28.346,4) + ' cm';                          y = roundToDP(xy[1]/28.346,4) + ' cm';                          w = roundToDP(sel.width/28.346,4) + ' cm';                          h = roundToDP(sel.height/28.346,4) + ' cm';                          break;                                               case 'mm' :                          x = roundToDP(xy[0]/2.834645,3) + ' mm';                          y = roundToDP(xy[1]/2.834645,3) + ' mm';                          w = roundToDP(sel.width/2.834645,3) + ' mm';                          h = roundToDP(sel.height/2.834645,3) + ' mm';                          break;                                               case 'in' :                          x = roundToDP(xy[0]/72,4) + ' in';                          y = roundToDP(xy[1]/72,4) + ' in';                          w = roundToDP(sel.width/72,4) + ' in';                          h = roundToDP(sel.height/72,4) + ' in';                          break;                                               case 'pi' :                          // Need to fix these strings yet…                          x = roundToDP(xy[0]/12,3) + ' pi';                          y = roundToDP(xy[1]/12,3) + ' pi';                          w = roundToDP(sel.width/12,3) + ' pi';                          h = roundToDP(sel.height/12,3) + ' pi';                          break;                                               case 'pt' :                          x = roundToDP(xy[0],4) + ' pt';                          y = roundToDP(xy[1],4) + ' pt';                          w = roundToDP(sel.width,4) + ' pt';                          h = roundToDP(sel.height,4) + ' pt';                          break;                                               case 'px' :                          x = roundToDP(xy[0],3) + ' px';                          y = roundToDP(xy[1],3) + ' px';                          w = roundToDP(sel.width,3) + ' px';                          h = roundToDP(sel.height,3) + ' px';                          break;                                     }                      var pic = File('~/Desktop/aiSelection.png');                doc.imageCapture(pic,sel.visibleBounds,undefined);                                     paletteCoOrds(pic,ab,x,y,w,h);                           }                 } }; function roundToDP(n,dP) {            return Math.round(n*Math.pow(10,dP))/Math.pow(10,dP);            }; // Find ruler units in file data function aiRulerUnits(f) {            var rulerUnits = undefined;            f.open('r');            while (!f.eof) {                      var line = f.readln();                 if (/^%AI\d_RulerUnits:/.test(line)) {                                var d = line.match(/\d$/);                                switch (Number(d)) {                                          case 0 : rulerUnits = 'in'; break; // Inches                     case 1 : rulerUnits = 'mm'; break; // MM                     case 2 : rulerUnits = 'pt'; break; // Points                     case 3 : rulerUnits = 'pi'; break; // Picas                     case 4 : rulerUnits = 'cm'; break; // CM                     case 6 : rulerUnits = 'px'; // Pixels                                     }                           f.close();                           return rulerUnits;                                          }            } // EOF      f.close();            return rulerUnits; }; // The palette function paletteCoOrds(selPng,selab,selX,selY,selW,selH) {      var palWin = new Window('palette');      palWin.preferredSize = [150,200];      palWin.opacity = 0.9;      var red = (1/256)*204, green = (1/256)*102, blue = 0;      palWin.graphics.backgroundColor = palWin.graphics.newBrush      (palWin.graphics.BrushType.SOLID_COLOR,[red, green, blue]);      var header = palWin.add('statictext');      header.text = 'Selection Info…';      header.graphics.font = ScriptUI.newFont('Helvetica', 'Bold', 14);      header.graphics.foregroundColor = header.graphics.newPen      (header.graphics.PenType.SOLID_COLOR, [1.0, 1.0, 1.0], 1);            // Written by Marc Autret      Image.prototype.onDraw = function() {           if( !this.image ) return;           var WH = this.size,           wh = this.image.size,           k = Math.min(WH[0]/wh[0], WH[1]/wh[1]),           xy;           wh = [k*wh[0],k*wh[1]];           xy = [ (WH[0]-wh[0])/2, (WH[1]-wh[1])/2 ];           this.graphics.drawImage(this.image,xy[0],xy[1],wh[0],wh[1]);           WH = wh = xy = null;      }      var pic = palWin.add('image', undefined, selPng);            pic.size = [100,100]; // How big you want the image here…            selPng.remove(); // Dump the image we've used it…            var abText = palWin.add('statictext');      abText.text = 'Artboard: ' + selab;      abText.graphics.font = ScriptUI.newFont('Helvetica', 'Bold', 12);            var xGroup = palWin.add('group');      var x = xGroup.add('statictext');      x.graphics.font = ScriptUI.newFont('Helvetica', 'Bold', 12);      x.text = 'X:';      var xEdit = xGroup.add('edittext');      xEdit.characters = 10;      xEdit.text = selX;            var yGroup = palWin.add('group');      var y = yGroup.add('statictext');      y.graphics.font = ScriptUI.newFont('Helvetica', 'Bold', 12);      y.text = 'Y:';      var yEdit = yGroup.add('edittext');      yEdit.characters = 10;      yEdit.text = selY;            var wGroup = palWin.add('group');      var w = wGroup.add('statictext');      w.graphics.font = ScriptUI.newFont('Helvetica', 'Bold', 12);      w.text = 'W:';      var wEdit = wGroup.add('edittext');      wEdit.characters = 10;      wEdit.text = selW;            var hGroup = palWin.add('group');      var h = hGroup.add('statictext');      h.graphics.font = ScriptUI.newFont('Helvetica', 'Bold', 12);      h.text = 'H:';      var hEdit = hGroup.add('edittext');      hEdit.characters = 10;      hEdit.text = selH;      var beGone = palWin.add('button',undefined,'Be Gone…');      palWin.center();      palWin.show();      beGone.onClick = function() {                      // Fadeout locks focus for a short while…           for (var i = 90; i > 10; i--) {                $.sleep(10);                palWin.opacity = i/100;           }           palWin.close(); // Be gone…      }; };

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 12, 2011 Apr 12, 2011

WOW!! very nice Mark, I love the fading effect and the idea of having a snap shot of the selection.

ok, then maybe if you duplicate the selection, add a square underneath, and dim the square.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Apr 12, 2011 Apr 12, 2011

Carlos, that 'begone' fade out made me laugh… didn't think it would actually work… looked fun, capturing images to use looked pretty funky too. Im new to using scriptUI so it looked like a good learning subject… Now sticking a white box of 50ish% may be an option… Hadn't thought of that one, could be a useable alternative thanks… I will have to play some more. Do you know where you would store a text file preference on a windows box?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 12, 2011 Apr 12, 2011
LATEST

they're both pretty cool/fancy interface features, great job.

The pref file doesn't have to be in a special place, does it? I would think it goes where the script file is, right? or in a system folder, like the desktop or appData, there is a list of folders in the Tools Guide.

in VB for getting/setting preferences we usually use the Registry, I don't think is accesible with JS.

by the way, I got "undefined" instead of the actual measurements, I'm CS5 Win xp

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines