How can I set a polygon's path by using the .add() function?

I have been searching the web and this forum and doing plenty of experimenting, and I can't for the life of me figure out how to do this.
I can set other attributes of a polygon inside the add() parentheses, such as the fillColor, but I can't set the polygon's path's pathPoints unless I use a separate line of code after the add(); line.
My script adds a great deal of polygons in a row, so halving the number of operations would greatly help me, and also it seems that some properties such as appliedObjectStyle cannot be set until after a polygon's path is defined. That means I need a third line of code after add() and entirePath=, which slows me down even more.
Help?

Ryan, I think you need to reset and take a moment to understand what it is that is going on here.
The things you've proposed that don't work shouldn't work, and it's all quite simple.
Generally speaking, a .add() function takes an additional parameter, a JavaScript Object, that list properties of the created object that can be set.
A JavaScript Object is a list of key/value pairs, just like an associative array in a language like perl, or a dictionary in a language like Python. It is expressed in curly braces as such:
{ key1: value1, key2: value2, key3: value3}
So, for any such general add function, these
foo = whatever.add();
foo.bar = baz;
are equivalent to this:
foo = whatever.add({bar: baz});
Are you with me? So, for instance, you had originally asked why you could not use pathPoints in polygons.add() and the answer is simpe. You cannot set polygon.pathPoints, because there is no .pathPoints property of a polygon.
So, when you want to try add properties inside properties, you must do as as objects within objects, and follow the strict hierarchy. Marc advises that this works:
app.activeWindow.activePage.polygons.add({
    fillColor:"FireRed",
    transparencySettings: {dropShadowSettings: {angle:120}}
and if indeed that is so, then the extension for setting multiple transparencySettings should be clear. It is not this, that you propose:
app.activeWindow.activePage.polygons.add({
    fillColor:"FireRed",
    transparencySettings: {dropShadowSettings: {angle:120}}
    transparencySettings: {dropShadowSettings: {distance:1}}
Because to do so is to set the transparencySettings key twice in the same Object. And to do that is to replace the first with the second. The above (yours) is wholly equavelent to:
app.activeWindow.activePage.polygons.add({
    fillColor:"FireRed",
    transparencySettings: {dropShadowSettings: {distance:1}}
If you wish to set more than one attribute of dropShadowSettings, you must set transparencySettings to an object containing one and only one dropShadowSettings, and you must do it only once. So it is this:
app.activeWindow.activePage.polygons.add({
    fillColor:"FireRed",
    transparencySettings:
      {dropShadowSettings: {angle:120, distance: 1}}
I am not sure why you thought you should have the name of the key in the Object named properties. That is probably because in some cases you can use:
foo.properties = { a: 1, b: 2};
as a shorthand for
foo.a=1;
foo.b=2;
but you would [probably] never want to mix that with the object notation for setting multiple properties in the .add() function.
Does this help to clarify?
As for your last question:
Also, it doesn't let me use square brackets or parentheses inside the add() parentheses, so the original problem I posted (trying to set a polygon's path) is still a problem.
It's not about the use of brackets or parentheses, but what they mean and where they go. As you have not posted an example of setting the polygon's path the long way, it's hard to show you how to shorten it. Post what you have that works, and we will show you how to shorten it. (I suppose some with more patience than I are willing to go look up what we think it is you are trying to do, and then interpret it. But I would much rather you show me the code you have that works, and then your attempts to transform or shorten it and change its notation. This makes it much much easier to help you, and it should also make the help more effective, by contextualizing it. As an added benefit, when someone else reads your post and tries to learn from it, they will gain more.)
So again, please provide a clear example of the "long way" to do the thing you are attempting, and then your attempt at shortening it.

Similar Messages

  • How can I set up an older airport express using the newest airport utilities?

    How can I set up an older airport express using the newest airport utilities? Seems like there isn't an option to set this up.  Normally you could add/set up this in the airport setup assistant- but that doesn't exsist any longer.
    Thanks for any suggestions 

    How can I set up an older airport express using the newest airport utilities?
    Unfortunately you can't, since Apple dropped support of the older AirPorts with AirPort Utility 6.x.
    Using some workarounds....not supported by Apple.....you might be able to download and install an older version of AirPort Utility that would allow you to administer the older AirPort.
    See this thread for more details and instructions:
    https://discussions.apple.com/message/21397085#21397085

  • How can I set up a wi-fi network, using one time capsule and two airport express

    how can I set up a wi-fi network, using one time capsule and two airport express ?
    The time capsule is near the Mac. ok
    The first Airport is on the corridor, ok, works well and the App on the iPad signals so, ok
    But when I plug the next Airport on another room nearby nothing happens, and signals disconected ....
    is the signal so weak that is not able to go to ono room to the other ?

    Well, even if you have the first express set up to extend the network, the second express can only extend from the TimeCapsule.
    Maybe you got walls of sheetrook in the way, or kitchen/bathroom tiles, etc, dampening the signal rapidly.

  • How can I set a gap in a JTextField, before the active Textfield starts?

    Hi,
    how can I set a gap in a JTextField, before the active Textfield starts?
    I'll avoid, that the input text starts immediately after the border of the JTextField.
    Btw, how can I set the height of the JTextField in a BoxLayout?
    Thx.
    Hans

    Yes, that was also my thinking, but nothing happens.
    Maybe You have an idea :-)
    Thx, Hans
    Here a part of my code:
      private JPanel createEntry(String label, JTextField jtf, String initJtf, boolean editable) {
        jtf.setColumns(15);
        if (editable) {
          jtf.setEditable(true);
          jtf.setBackground(new Color(191, 191, 255));
        else {
          jtf.setEditable(false);
          jtf.setBackground(SystemColor.control);
        jtf.setText(initJtf);
        jtf.setForeground(Color.black);
        jtf.setBorder(BorderFactory.createLoweredBevelBorder());
        jtf.setMargin(new Insets(50, 20, 50, 40));   // <-  The PROBLEM
        JPanel panel = new JPanel();
        GridLayout gl = new GridLayout(1, 2);
        gl.setHgap(1);
        panel.setLayout(gl);
        panel.add(BxpCdmUtils.Utils.createLabel(label, Color.darkGray, Font.BOLD, 11));
        panel.add(jtf);
        JPanel superpanel = new JPanel();
        superpanel.setLayout(new BoxLayout(superpanel, BoxLayout.X_AXIS));
        superpanel.add(panel);
        superpanel.add(new JLabel(" "));
        return superpanel;
      }

  • How can I set BOE XI R2 InfoView to use MM/DD/YYYY date format?

    How can I set BOE XI R2 InfoView to use MM/DD/YYYY date format instead of the default yyyy-mm-dd that comes up?
    Thank you.
    Paul

    I'm sorry to be dense.  Are you using BOE XI R2?  I don't see a "preferred viewing local" under preferences.  I see "My Interface Locale is..." under the General tab, which I have set to United States.  I don't see anywhere where I can enter in the dates and numbers.
    I also checked in the CMC under Business Object Enterprise applications, and did not see anything there either.
    Can you be specific?
    Thanks again.
    Paul

  • Auto-Capitalization: How can I set Pages v5.01 to auto-capitalize the first letter of the first word in a sentence and to automatically change lower case "i" to "I" appropriately. I'm unable to find a menu that offers me these.

    Auto-Capitalization: How can I set Pages v5.01 to auto-capitalize the first letter of the first word in a sentence and to automatically change lower case "i" to "I" appropriately. I'm unable to find a menu that offers me these.

    Gavin Lawrie wrote:
    Once it had been established that the iWork rewrite had resulted in some features being lost and others broken, and once Apple had acknowledged the concerns* and suggested they are working on fixes**, I'm not sure what else there is to achieve.
    You are writing that in the perspective of having read about it here already. Repeated often enough that you encountered it somewhere in the posts.
    Users are flooding in here and don't know any of this. Of course we have to repeat everything endlessly.
    Because I like to give precise, understandable and workable answers to repeated questions, and Apple doesn't allow sticky posts here, I created a separate forum which users can consult to look up real answers, and contribute for themselves if they have something valuable to add:
    http://www.freeforum101.com/iworktipsntrick/
    There is a section purely devoted to Pages 5. Add whatever answers you feel will lighten the problems of Apple's 'upgrades'.
    Peter
    * Where have they acknowledged anything?
    ** They have barely anything listed, compared to the massive list of deleted features, and nothing but an extraordinarily long time frame considering they created the problems here and now. Apple has not said they will do anything at all about fixing the real issues, the biggest of which is that the new iWork apps break virtually all the work of existing users.

  • How can I set up a guest WiFi network using Time Capsule and Airport Express extension?

    How can I set up a guest WiFi network using Time Capsule and Airport Express extension?

    Sorry, but it is not possible to "extend" the Guest Network using either wireless or an Ethernet connection.

  • I bought a used iPhone and found him email iCloud does not affect me so how can I deleted this email in order to use the device freely and privacy

    I bought a used iPhone and found him email iCloud does not affect me so how can I deleted this email in order to use the device freely and privacy
    help me please

    You can't. Return the phone for a refund, if you can, because without the previous owner's Apple ID/Password, you will not be able to re-activate the phone. It will be useless to you.
    Apple can't/won't help you with this.

  • How can we share and transfer data at Labview using the internet

    How can we share and transfer data at Labview using the internet
    Dr. Eugene Berman, Moran Kamilyan and Ravit Bar

    [email protected] wrote:
    How can we share and transfer data at Labview using the internet
    Check these links:
    Basic TCP/IP Communication in LabVIEW
    Data Sockets
    Integrating the Internet into Your Measurement System

  • I live in Afghanistan how can I have a free Apple ID to use the free app

    I live in Afghanistan how can I have a free Apple ID to use the free app

    Try to go into the App Store and try to download an app. When you have the option to sign in or create an Apple ID, choose to create one and you should see a 'none' option under payment.

  • How can I set up Lync for my personal use?

    How can I set up Lync 2013 for my personal use. I don't have any personal domain (using outlook, hotmail etc) or any server.  Is there a way, I can still set up Lync on my PC? Please advise.

    You can't use a personal email account (MSN/Gmail/etc..)
    to sign into the Lync client. You can purchase an account from Lync Online: http://office.microsoft.com/en-us/lync/lync-online-overview-and-features-online-meetings-and-instant-messaging-FX103789571.aspx 

  • How can i set a column which would show me the name of the user

    how can i write a trigger which would show me the name of the user now make changes in the table.

    872959 wrote:
    how can i write a trigger which would show me the name of the user now make changes in the table.I think what sb is trying to say is: if you mean the database user, you can use the USER session variable to identify the database user:
    http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/functions227.htm#SQLRF06156
    you would write a before each row trigger to update an "updated_by" column on your table to be USER.
    e.g.:
    :new.updated_by := USER;

  • HT201205 How can I connect to a bluetooth devise and use the head phones at the same time? I have a new  ipod Touch  (32GB)'and want to play through a stereo system using the headphone jack and connect to a blue tooth speaker in another room

    How can I

    Not possible, there is a physical switch inside the headphone port, when the headphone jack is plugged in the switch is open and disables the iPod speaker and Bluetooth networks. Cheers.

  • HT1212 I just updated my Ipad 2 to IOS7, now it is asking me for a passcode. I never set a passcode on my Ipad, so how can I enter a passcode. I tried using the OIS7 passcode I use on my Iphone  and it did not work and now my Ipad is disabled

    I just updated my Ipad 2 to IOS 7, now it is asking me for a passcode. I never set a passcode on my Ipad, so how can I enter a passcode. Earlier today I upgraded my Iphone 5 to IOS 7 and it asked me to set a passcode, which now works fine on my Phone. I  tried using the OIS7 passcode I use on my Iphone 5 and it did not work and now my Ipad is disabled. Both devices are on icloud and share the same apple id. The Ipad screen says slide to set up but then there is a prompt for passcode, not for setting up passcode

    I called Apple Support and a supervisor helped resolve this for me on my iPad. I suggest calling them for help as this is obviously an issue with the iOS 7 update - she helped me without charge. I could be missing something in my upcoming description, so do not take this as complete - call them.
    I had to update iTunes on my Mac Air to the latest version, and I had an iCloud backup from the day I updated to iOS7. Have iTunes open but do NOT connect your iPad yet. Shut down the iPad. Then press/hold the Home key on the iPad while you connect the USB from the iPad to the computer (an image of the USB cable appeared on the iPad). Follow the prompts in iTunes to restore and then backup using iCloud. When the iPad rebooted again to do the backup install, I got the same pass code issue and iTunes would not recognize the iPad without entering a pass code. I disconnected the iPad, turned it off, pressed the Home key while connecting the USB cable. When I did the restore and backup from iCloud the second time, it worked without the pass code issue occurring.

  • How can I set the caption text of picture controls inside an array or how can I choose which array element is assigned using the array elements caption text property.

    I have 8 picture controls inside an array and I would like to set the caption text of these controls.
    I have used the property node of the array and used the array elements property caption text to set the text.
    The problem is however that I set the same text to all the picture controls inside the array.
    My question is how to set caption text of specific elements (Picture control) that I have so far only been able to access using the array elements caption text property.

    Some more help
    1 You could use the caption of the array and place it in front of the selected picture and update that using property nodes.
    2 Like Norbett said if you use a cluster of pictures then their caption can be updated individually.
    Here is a an example that demonstrates the above
    David
    Attachments:
    Modify the Captions Of Pictures.vi ‏83 KB

Maybe you are looking for

  • How do I burn multiple images from iPhoto to cd?

    I have downloaded some family vacation photos to iphoto.  iphoto separated them into four events with a total of 161 pictures.  I tried to "burn" one event at a time to a non rewrite CD.  After the first "burn" the program said that this CD was not r

  • JTable = Cell Alignment

    Is it possible to centre align data in a JTable cell? If possible, where can I see how to do so. Thx

  • Native signing not supported on mac!!

    To sign both the installer and its executable we're using Thawte and Comodo certificates. For MacOS we've Thawte and Apple. This following command builds a proper signed installer version (along with its executable .exe) with the combination of both

  • OpsMgr Config Service stops automatically

    There's a fresh installation of SCOM 2007 SP1, SQL database is configured on a separate server. The installation itself goes smoothly without any errors. After installation to RTS OpsMgr Config Service stops automatically, after restart it works for

  • How to delete a game in ipad?? need help

    hi, Can someome guide me,how to delete a game in ipad. thnx, Sa3ood Message was edited by: Sa3ood