« Back

Toolbox Override default Toolbox Icons

Combination View Flat View Tree View
Threads [ Previous | Next ]
Toolbox Override default Toolbox Icons
graphrep visualisation configuration adoxx
Answer
1/9/19 1:28 PM
Hello,

Is there a possiblity to overwrite the default toolbox represenation by defining a graphrep which is only used for the toolbox represenation?
This means i want to have a graphrep for the toolbox icon and one graphrep which is used for modeling.

By default as you can see in the attached picture adoxx the toolbox and modeling editor represenation is similar.

(I use adoxx Version 1.5)

Thank you for your help.

BR
Martin
Attachment

Attachments: Toolbox.png (17.4k)

RE: Toolbox Override default Toolbox Icons
on_event external coupling graphrep aval library attributes beforecreateinstance if get_class_name attribute attribute type set_attr_val
Answer
8/13/18 7:45 AM as a reply to Martin Paczona.
One possibility is to create two different representations in the GraphRep code and switch between them using an attribute e.g. „Representation“ (type: Integer). For example you can set Representation to 0 by default and define the GraphRep code for the case that Representation=0. This graphical representation will be then shown in the Toolbox. If you want to model and thus create an instance of the specific class, then you can use an event to change the value of the Representation variable to 1. Then you can define a different graphical representation in the GraphRep attribute for the case Representation = 1.

Example: Different representation for the class „W“ in the Toolbox and the Modelling area:
1. Create an attribute “Representation” of type integer for the class „W“

2. Define the code in the GraphRep attribute for the 2 different cases:
 1GRAPHREP layer:-1 sizing:asymmetrical
 2
 3#get the value of Representation attribute (0 by default) and assign it to the variable rep
 4AVAL rep:"Representation"
 5
 6IF (rep = "0") {
 7  #this graphical representation will be shown in the Toolbox
 8  FILL color:blue
 9  POLYGON 3 x1:-1cm y1:1cm x2:0cm
10  y2:-1cm x3:1cm y3:1cm
11  ATTR "Name" x:0cm y:1cm w:c
12}
13ELSIF (rep = "1") {
14  #this graphical representation will be shown in the Modelling area
15  SHADOW off
16
17  FILL color:blue
18  ELLIPSE x:0.00cm y:0cm rx:1cm ry:1cm
19  FILL color:yellow
20  ELLIPSE x:0.00cm y:0cm rx:0.5cm ry:0.5cm
21
22  ATTR "Name" x:0.00cm y:1.0cm w:c
23}

3. Go to Library attributes→Add-ons and add the event „CreateInstance“ to the External coupling:
 1ON_EVENT "CreateInstance" {
 2  CC "Core" GET_CLASS_NAME classid:(classid)
 3  #--> RESULT ecode:intValue classname:strValue isrel:intValue
 4
 5  IF (classname = "W") {
 6    #if an object of class "W" is created then the value of the "Representation" attribute is changed to 1
 7    CC "Core" SET_ATTR_VAL objid:(instid) attrname:("Representation") val:(1)
 8  }
 9}
Attachment

Attachments: Switch representation.JPG (46.0k)

RE: Toolbox Override default Toolbox Icons
Answer
9/28/18 8:00 AM as a reply to Mateusz Dziedzic.
Thanky you for your help this solution works well =)

BR
Martin