Confused on creating a rectangle and validating its size & position afterwards

If one creates a rectangle in a layer like this:
var childLayer = parentLayer.pathItems.rectangle(top, left, someWidth, someHeight);
childLayer.stroked = false;
childLayer.filled = true;
After creating the rectangle, would one read it back like this:
var bounds = childLayer.geometricBounds;
alert("bounds: "+bounds[0]+","+bounds[1]+","+bounds[2]+","+bounds[3]);
or should I use visibleBounds, or controlBounds? Or something else?
I know if stroke not used or can exclude can use geometric bounds? Or rather all 3 bounds could be the same in that case?
I'm confused right now because I'm assuming the bounds represent the four corners of the rectangle's position in the document and when read back out, the values (bounds[0] and bounds[1]) don't match against the top & left values originally passed in to create the rectangle. Shouldn't they be the same?
If not, how am I supposed to validate that the layer/object uses the same top & left values for it's position as when the rectangle was created (for say validation purposes)?
Also I assume I should be able to fetch the position of one corner using childLayer.top & childLayer.left as well right? For some reason, that doesn't match with top & left either.

Using your code snippet, I get same values. I'm using Adobe Illustrator CS6 (64-bit).
But using a slightly different snippet, adapted from original script code I'm working with:
var doc = app.activeDocument;
var finishedWidth = 6.74 * 72;
var finishedHeight = 4.84 * 72;
var top = (362.88 - finishedHeight) / 2;
var left = (502.56 - finishedWidth) / 2;
alert("orig left: "+left+", top: "+top+", width: "+finishedWidth+", height: "+finishedHeight);
var trimLayer = doc.pathItems.rectangle(top, left, finishedWidth, finishedHeight);
alert("done left: "+trimLayer.left+", top: "+trimLayer.top);
var bounds = trimLayer.geometricBounds;
alert("bounds: "+bounds[0]+","+bounds[1]+","+bounds[2]+","+bounds[3]);
the results are off regarding trimLayer.left & trimLayer.right compared to the original top & left values passed in. But the bounds values are correct. From your code snippet, I checked the rect.left and rect.top & it's still correct.
Here's the output of the alerts (with some rounding of values as opposed to what was displayed):
orig left: 8.64, top: 7.19, width: 485.28, height: 348.48
done left: 8.14, top: 7.7
bounds: 8.64,7.2,493.92,-341.28
and debugging the original script code, the script I'm working with, (the rect.left, rect.top and) the bounds don't match up, with a difference from 0.14 to 0.42 to the actual value it's supposed to be. Extracting the area of code that I'm debugging out (for generalization and sharing code) results in the snippet above, and for some reason there, outside the context of the full script, the bounds are correct but not the rect.left & rect.top. Unfortunately, can't share the rest of the code at present.
Guess I'll have to investigate further, with help from my team's developers. At the moment I'm perplexed by these variations. Logically, from reading the code & scripting reference, I would have expected the values to match up in all cases.

Similar Messages

  • [CS3 JS]  Create a rectangle and set it to cropBox?

    Im very new to illustrator. I have a text file containing the geometricBounds of a rectangle from indesign. (using as my crop guide). Once in illustrator I tryed to assign this to the cropBox but it doesnt take, saying it expects rectangle values. So Im asking how do I create a rectangle (and then reference it to the cropBox)?
    Thanks

    You don't need a rectangle as you do in the UI. Try this:
    var b = app.documents[0].cropBox;
    var mytop = 77;
    var myleft = 5;
    var myright = 405;
    var mybottom = 7;
    var mywidth = myright-myleft;
    var myheight = mytop-mybottom;
    var aRect = app.documents[0].pathItems.rectangle (mytop, myleft, mywidth, myheight, false);
    app.documents[0].cropBox = [myleft, mytop, myright, mybottom];
    The first line tells you what you are looking for: an array of 4 values.

  • How to create a file and store its contents into another file?

    Hi,
    I'm having some trouble trying to create a code where I have to to create a file and store its contents into another file?
    I read the API, but I'm not certain how this file thing works.
    Here's my code so far:
    public static void main(String[] args) throws Exception
              File file = new File("tasks.txt");
              if (file.exists())
                   System.out.println("File already exists");
                   System.exit(0);
              Scanner scan = new Scanner(System.in);
              Scanner scan2 = new Scanner(System.in);
              //Scans the input line by line
              scan.useDelimiter("\\n");
              //Scans the input by tabs
              scan2.useDelimiter("\\t");
              PrintWriter outputs = new PrintWriter("newtasks.txt");
              outputs.print("ok");
              outputs.println(3);
              outputs.close();
         }

    I managed to change my text into uppercase, but how do I store the uppercase content into another file.
    -So this is what I did so far, I took a text file and modified its strings to uppercase.
    -Now I need to put those modified strings into another text file, is there a way where I can do that with my current code?
    -I already tried printwriter, but it doesn't seem to work
    public static void main(String[] args)throws IOException
              //Task[] oneHundredTasks = new Task[100];
              String uppercase;
              String combine;
              Scanner scan = null;
              FileInputStream in = null;
            FileOutputStream out = null;
            PrintWriter output = null;
            try
                 scan = new Scanner(new BufferedReader(new FileReader("tasks.txt")));
                 scan.useDelimiter("\\n");
                 scan.useDelimiter("\\t");
                while (scan.hasNext())
                     if(!scan.hasNext())
                          scan.next();
                     combine = scan.next();
                     uppercase = combine.toUpperCase();
                     System.out.println(uppercase);
            finally
                if (scan != null)
                    scan.close();
            //The program will try the input and output files
            try
                 in = new FileInputStream("tasks.txt");
                out = new FileOutputStream("newtasks.txt");
                int c;
                //The number "-1" is used to indicate that it has reached the end of the stream.
                while ((c = in.read()) != -1)
                    out.write(c);
            finally
                if (in != null)
                    in.close();
                if (out != null)
                    out.close();
         }

  • Create Sales order and disable its records in Demand interface

    Hi All
    I have the case that i want to implement Planning and schedule module of oracle Manufacturing.
    what i need is
    1-Create sales orders
    2- Prevent this sales order
    3- import demand planed items through interface table .
    Thanks
    Abdelmohsen Amin

    Hi Abdelmohsen Amin;
    Welcome to forum. Please follow below link and see its helpful for your issue:
    [link 1|http://www.oracle.com/applications/scm/manufacturing-operations-center.html]
    [link 2|http://www.oracle.com/applications/manufacturing/process-manufacturing-master-production-scheduling-data-sheet.pdf]
    [link 3|http://www.oracle.com/applications/manufacturing/oracle-production-scheduling-data-sheet.pdf]
    [link 4|http://download.oracle.com/docs/cd/A60725_05/pdf/gemmsfc.pdf]
    Please also try this search
    Regard
    Helios

  • Image manipulation and keeping its size same

    Hi
    I am working on an iPad application which allow user to redact portion of an image. Currently i have added UIView to my imageView and draw brush path using UIBezierPath and save the image by taking snapshot of my Uiimageview. Everythings working fine except the image size, suppose my image is of 1.5 Mb then after saving an image it reduces to 0.5Mb.
    My requirement is that after saving image my image size should not reduce.
    if (UIGraphicsBeginImageContextWithOptions != NULL) {
                UIGraphicsBeginImageContextWithOptions(self.imageVw.bounds.size, NO , 0.0);
                [self.imageVw.layer renderInContext:UIGraphicsGetCurrentContext()];
                viewImage = UIGraphicsGetImageFromCurrentImageContext();
                UIGraphicsEndImageContext();
    This is what i am using to save an image.
    Is there any other way to manipulate image without losing its size. For example reading image pixels and writing and replacing new pixels to it?
    Looking for your answer.
    Thanks.

    Any help would be appreciated...

  • How to create a servlet and write its details in DD in PAR Application

    Hi Experts,
    I want to create a servlet in PAR application. This servlet should be capable of accessing the functions of other java files included in PAR Application. Servlet should be capable of accessing the functions say doContent(req, resp) of any class of PAR application.
    Is it possible to create Servlet in PAR application?
    I created one servlet but unable to declare its information in Deployment Descriptor.
    Because the deployment which is provide ie portalapp.xml doesnt allow us to write tags like <servlet-name>, <servlet-mapping>, <url-pattern> etc. These are necessary for declaration of servlet.
    So how can i write a complete working Servlet under PAR application?
    Please help and replies will be appreciated.

    Hi Pankaj,
    I don't think it is possible to write Servlet in portal applications.
    I guess in Portal Application Projects we can develop portal components and portal services only.
    Thanks and regards,
    -Madhu

  • Create a symbol and change its id

    Hi edge people
    I know how to create a symbol dynamicly but I want to change the id of the element to something other then random
    var mySymbolObject = sym.createChildSymbol("imageBox","stage");
    mySymbolObject.setVariable("id", "newname");
    I need to do this so I can access the element later
    Sorry for the simple question

    Hey richgizmo, here is how to dynamically create a symbol, then access it later. According to the API doc:
    // Create a new symbol "kitten_paw" on the Stage
    sym.createChildSymbol("kitten_paw", "Stage");
    // Reference the symbol
    var kitten_sym = kitten_paw.getSymbolElement();
    // Animate the opacity to 0
    kitten_sym.animate({opacity: 0}, 500);
    Here is the API for reference:
    http://www.adobe.com/devnet-docs/edgeanimate/api/current/index.html

  • Can you open a Jpeg graphic and reduce its size without it becoming pixilated and blurry?

    Hi I am new to Illustrator and photoshop.
    I am designing a birthday poster on A4.  I recently received a graphic of a bird that is in JPE and PNG format. When I
    opened the graphic it was huge - as big as the screen and looked fantastic, smooth outline and crystal clear.  Its a great
    graphic but I want to make a border of small birds to outline the poster.  When I downsized the graphic by transforming
    it to 10% its original size it looked really rubbish - all blurry and when i printed it out it was not very good at all!
    I'm obviously completely new to Adobe software so i don't know all the correct terminology.  Basically I just want the graphic
    of the bird to be alot  smaller and look as smooth and sleek as it does when its massive.  The graphic is 1200 x 1200 pixels
    and i want it to be about 50 x 50.  How do I do it?  Can it be done? Or is all my efforts in vain!!!
    A few people have said I need photoshop but when I tried it on there it still didn't work.  I'm wondering if its the graphic
    that is the problem.
    Thanks in advance for your help
    Lauren

    Go back to photoshop open the image in the in Phooshop then
    1 go to Image>Image Size
    2 uncheck at the bottom left the option to resample
    3 make certain Constrain Proportions is checked
    4 to the right of the width input field there is three drop downs on the top one select percent
    5 then in the width change the percentage to 10%
    6 now look at the resolution field if it is more than 300 or 355 ppi at this point check the resample art and change resolution setting to 300 or 355 ppi or what ever your printer prefers. It is not likely with this reduction it will be smaller than 300ppi.
    7 now save the file with a different name using the Save As command.
    8 place this file in Illustrator and make it symbol now place the symbols instances instead of copying it each time.

  • Rman create some files  and very big size

    Dear all,
    I was implement rman back up on windows 2003 R2 with oracle9i.When i ran script
    for backup as below :
    RUN {
    allocate channel ch1 type disk;
    CHANGE ARCHIVELOG ALL CROSSCHECK;
    CROSSCHECK ARCHIVELOG ALL;
    DELETE NOPROMPT EXPIRED ARCHIVELOG ALL;
    BACKUP DATABASE PLUS ARCHIVELOG;
    CROSSCHECK BACKUP;
    DELETE NOPROMPT EXPIRED BACKUP;
    DELETE NOPROMPT OBSOLETE;
    RELEASE CHANNEL ch1;
    EXIT;
    During executed these script i found rman create some files the name is "CQISBDNR_1_1" and the size around 17 gb. @ "D:\oracle\ora92\database"
    and my config as below :
    RMAN> show all;
    RMAN configuration parameters are:
    CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 2 DAYS;
    CONFIGURE BACKUP OPTIMIZATION OFF; # default
    CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
    CONFIGURE CONTROLFILE AUTOBACKUP ON;
    CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'E:\Rmanbk\CF%F'
    CONFIGURE DEVICE TYPE DISK PARALLELISM 1; # default
    CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
    CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
    CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT 'E:\Rmanbk\%d_DB_%u_%s_%p';
    CONFIGURE MAXSETSIZE TO UNLIMITED; # default
    CONFIGURE SNAPSHOT CONTROLFILE NAME TO 'E:\RMANBK\SNCFAPPR.ORA';
    What happend ? and Pls advise !
    Thanks for advance !
    Chara

    I don't see any thing wrong in having a 17Gb rman backup file. It is just your backup in a single piece. You have configured rman to use the maximum size possible:
    BACKUP DATABASE PLUS ARCHIVELOG
    and
    CONFIGURE MAXSETSIZE TO UNLIMITED; # default
    As long as you have enough space to grow and you can transfer your backup piece to a safe place in a timely manner, you may cope with this.
    ~ Madrid

  • I should not have to "expand" a rectangle before resetting its bounding box

    When you create a rectangle and rotate it, the Reset Bounding Box command is available to you, but selecting it does nothing. To get it to work, you have to "expand" the rectangle first, and then select Reset Bounding Box. This is idiotic. If I've explicitly told the program I want to reset the bounding box of said rectangle, and for whatever arcane reason it can only reset the bounding box of "expanded" rectangles, then it should "expand" the dang rectangle for me and reset the bounding box like I asked.

    As it is a Live rectangle and not a Real rectangle it has not been 'really' rotated.
    In the same way when you round its corners they are not 'really' rounded until the thing has been expanded.
    I am still in the same mindset for this.
    Rounded Rectangles should have been changed to live rectangles.
    And the Real Rectangle tool should have left alone.
    We now have a High End Vector Drawing Program without a simple rectangle tool
    I can't work out what the hell they were thinking.
    I'm worried about what the next tool to be broken will be.

  • How we create custom infotype and how to configure with its subtypes.

    hai abap-hr gurus,
    how to create custom infotype and how to configure with its subtypes. when i am creating infotypes i am not getting how to configure subtypes.
    plz help me for this with an example code.
    thanks..
    kiran kumar

    Hi Kiran,
        Please fallow the below steps to create the custom infotype. If you have any quires let me know.
    For Creation of Infotype first Go to Transaction PM01, Enter the custom Infotype number which you want to create, it should be a 4 digit number and have to start with 9xxx.
    then select the `Employee Infotype' radio button
    after that select the `PS Structure Infotype'
    then click on Create… A separate table maintenance window appears
    then Create a PS structure with all the fields you want on the infotype
    Save and Activate the PS structure
    now Go back to the initial screen of PM01
    Click on `All' push button. It takes a few moments
    Click on `Technical Characteristics’. Infotype list screen appears
    Click on `Change'(pencil) button
    Now select your Infotype and click on `Detail' (magnifying glass) button
    Give `T591A' as subtype table & also Give `T591S' as subtype txt tab
    Give your subtype field as subtype field & Save and come back to PM01 initial screen
    Click on `Infotype Characteristics' … Infotype list screen appears
    Click on `Change' (pencil) button & on New Entries
    and then Enter your Infotype number and short text Here we have to set different Infotype Characteristics as per the requirement. (Better open another session with some standard Infotype's infotype characteristics screen and use as the reference
    to fill yours). Now save ur entries
    Now the Infotype is created and ready to use.
    If you want to change the layout of the Infotype as per your
    requirement…
    In the PM01 initial screen…Select `Screen' radio button and give
    2000 as the screen name, then click on edit.
    In the next screen.. Select `Layout Editor' and click `Change'.
    Screen default layout appears…here you can design/modify the
    screen..change the attributes of the fields..etc.
    Save and activate. (Don't forget to `Activate at every level)
    Regards,
    Ramakrishna kotha.

  • Has anybody tried creating and validating a XML doc with XML Schema?

    Hi,
    Has anybody tried creating and validating a XML doc with XML Schema?

    With XMLBeans, an XML document may be created from and validated with an XML schema.

  • I am trying to log into the itunes store for the first time and it asks me to review my account so I do but every time I get to the bit where you fill in your bank details and address it tells me my payment method was declined and that its not valid?

    I am trying to log into the itunes store for the first time and it asks me to review my account so I do but every time I get to the bit where you fill in your bank details and address it tells me my payment method was declined and that its not valid?

    Same here and this is driving me crazy. I can buy, but can't upgrade. Grrr.

  • I bought iphone 5 in september last year and the whatsapp which I installed was free of cost.The number which I used is the one I was using in my android phone and validity for its expiring in april but for other users its lifetime free.how can I get it ?

    I bought iphone 5 in september last year and the whatsapp which I installed was free of cost.The number which I used is the one I was using in my android phone and validity for its expiring in april but for other iphone users its lifetime free.how can I get the lifetime free validity?

    kratigupta wrote:
    how can I get the lifetime free validity?
    Huh? AFAIK, such does not exist. Read here:
    http://www.whatsapp.com/faq/general/23014681

  • I am trying to create an executable vi that will call out another vi and show its front panel in the executable​. When I try this I recieve this error message "top level vi (my main vi) was stopped at unknown on the block diagram of (my sub vi)

    I am trying to create an executable vi that will call out another vi and show its front panel in the executable.  When I try this I recieve this error message "top level vi (my main vi) was stopped at unknown on the block diagram of (my sub vi)

    Well the most common way is to enclude the vi's in the build spec either directly in the dependancies that the App builder automatically generates OR by declaring them in the build spec as "additional enclusions" (like you must do for dynamic vi calls in your app.
    I have heard rummors about My.app Stuff.vi in a nugget Intaris posted- and I've wanted to dig deaper into Intaris' claims- but have not tried it myself.
    If you go down the stuff.vi route Keep us curious guys posted
    Jeff

Maybe you are looking for

  • Chart legend too wide when using horizontal layout

    I am using a flex chart with about 15 series on it. I've set the legend direction variable to "horizontal". However since the panel width which contains the chart is fixed, the legend sprawls out to the right instead of going "wrapping around" nicely

  • Pwr Over

    Hi NetPro, anyone knows this ? i have no any device using PoE, but i still have this error. Nov 1 07:53:07: %C4K_IOSMODPORTMAN-4-INLINEPOWEROVERWARNING: Inline power exceeds threshold: Module status changed to 'Pwr Over' Nov 1 17:51:13: %C4K_IOSMODPO

  • JTabbedPane with JTextField

    Can anyone provide me with an example on how to incorporate a JTextField into a JTabbedPane? There are many examples of creating JButtons as components of a JTabbedPanes but nothing for JTextFields. Can this be done? I get some wierd compiler errors

  • Select-options and ALV

    Hi all, I have create a select-options with 5 fields and alv  and a button(get list) in webdynpro, i have to retrieve the values into alv from table through select-options by clicking on button. and i have written a function module for select options

  • Installing ODBC Driver for Windows Server 2008 64 bit

    I have a new Windows 2008 server 64 bit in which the Oracle ODBC is missing. We are on Oracle 10.2. It looks like I need to install the developer suite first in order to get tnsnames and sql plus, but I can find only the 32 bit version. Could someone