Change Design Background Colour with PML

How can I change the design background colour with PML ?

Thanks

Parents
  • Hi,

    You can access your current view instance using !!fmsys.currentDocument().view.
    Then you can modify its background attribute with the color of your choice.
    Example for a white background (10):

    !!fmsys.currentDocument().view.background = 10

  • That worked.

    Thanks very much

    What about toggling the shading on/off  from the command line ?

    Maybe you can help me with my other issue - Changing items colours in the model seems very flaky with the enhance command. I get mixed results but I see that if you use the std drawlist form it works perfectly. I tried to look at the PML from that and couldn't work out what the command they use to achieve this. Do you know the command line to do this ?

  • If you are referring to the background color gradient, you can disable it using the gradient attribute, like this:
     !!fmsys.currentDocument().view.gradient = false

    Regarding the Enhance command, I don't see any particular problem.

    You have to be vigilant about the type of element on which it is launched, and take into consideration that the color defined on the CE will take priority over the temporary color defined by the Enhance.

    If you want permanent color management, you can also look at the Autocolor rules.

  • Thanks for that.

    As for the enhance colour command, it does not behave how the colouring works in the drawlist form. The drawlist form seems to change the items permanently which is what I want (but from my menu / command line), so when you click on that item it doesn't change colours as it can do with enhanced items. Autocolour is not what I want. We have standard colours for items, but when I work I like to change colours of items at times, preferably without having to load the drawlist form everytime.

  • If you want to reproduce the same behavior as the Drawlist management window, you can use the Drawlist object.

    Here is how to get the instance of the current Drawlist object in PML:

    !currentDrawlist = !!gphdrawlists.drawlist(!!fmsys.currentdocument().view)

    Then, you can know the current color of an element for example:

    q var !currentDrawlist.colour(!!ce)

    Or change the color of an element:

    !currentDrawlist.colour(!!ce, 5)

    You can also apply this command to an Array of elements if needed:

    !gensecs = !!collectAllFor('GENSEC', '', !!ce)
    !currentDrawlist.colour(!gensecs, 5)

  • Thanks for your help. Works a treat

    Is there any documentation on E3D PML commands and objects etc

    I can't seem to find much other than what is in the software manual which mostly deals with PML1 and the basics


  • In the Aveva WebHelp: 
    https://help.aveva.com/AVEVA_E3D_Design/3.1.5/wwhelp/wwhimpl/js/html/wwhelp.htm#tab=contents

    The "Software Customization" part is quite complete for the PML (the "object type details"  lists the main PML objects and is quite useful):

  • When 1 item is selected you can use the global variable !!ce to access that item

    Is there a variable for when multiple items are selected - Current selection ?

    Also as an example of documentation I can't find. The command "!!collectAllFor" you used I cannot see in any online help. It's like you have an extra lot of information or manuals. I know the standard "collect all for...."  etc

    I've done quite a bit of VBA programming in the past and it's very well laid out and you can see all the classes and what are valid members of each class and what format the properties should be etc etc

    I find the documentation on PML not so good

  • Yes, can you ask the question concerning the Current Selection in a new topic (to avoid going too far from this topic) please?
    I will answer it.

    Concerning the documentation that I shared with you, it contains the main mechanisms of PML, but there is not an exhaustive list of all existing PML objects.

    There are for example a good number of objects which are defined in the PMLLIB folder of the Aveva installation (this is the case of the !!collectAllFor function) and which are not explained in the help.

    I know this information because I know how to dig into the source code of the software both on the PML part and on the .NET part. I understand this can be frustrating and time consuming, but it's foolproof !

Reply
  • Yes, can you ask the question concerning the Current Selection in a new topic (to avoid going too far from this topic) please?
    I will answer it.

    Concerning the documentation that I shared with you, it contains the main mechanisms of PML, but there is not an exhaustive list of all existing PML objects.

    There are for example a good number of objects which are defined in the PMLLIB folder of the Aveva installation (this is the case of the !!collectAllFor function) and which are not explained in the help.

    I know this information because I know how to dig into the source code of the software both on the PML part and on the .NET part. I understand this can be frustrating and time consuming, but it's foolproof !

Children
No Data