Welcome, Guest
Username: Password: Remember me

TOPIC: Compile from source with new classes

Compile from source with new classes 6 years 7 months ago #8293

  • AutoMate
  • AutoMate's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 134
  • Karma: 0
While building a custom class graph, a cosmetic GE question has emerged: How to display strings in values as left-justified or centered? Below, three sub_graphs are shown: two are pwr_valuemedium and the other is pwr_valuemediumcenter. Custom class $Intern strings are displayed: pwrs:Type-$String80 and pwrs:Type-$String16. The bottom Value.attribute is configured as $object.Message##String80 with Value.format = %s. These custom class strings are displayed correctly, but are not left-justified or centered. Strings displayed with either sub_graph pwr_valuemedium or pwr_valuemediumcenter appear the same. Is there a way to display $object strings as left-justified or centered? What am I missing?

Proview_String_Formats.png


/Ron
The administrator has disabled public write access.

Compile from source with new classes 6 years 7 months ago #8297

  • claes
  • claes's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 3063
  • Karma: 0
Hi Ron,

A value field consists of a filled rectangle and an annotation. When the value field is scaled in horizontal direction, also the position of the annotation is scaled, so it's impossible to get justified texts with different horizontal scale of the value fields.

I use make the frame invisible by setting border and fill color to the background color, and draw an external frame if thst is needed.

/Claes
The administrator has disabled public write access.
The following user(s) said Thank You: AutoMate

Compile from source with new classes 6 years 7 months ago #8298

  • AutoMate
  • AutoMate's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 134
  • Karma: 0
Hi Claes,

That makes sense.
Thanks again for your terrific support.

Regards,
/Ron
The administrator has disabled public write access.

Compile from source with new classes 6 years 7 months ago #8299

  • AutoMate
  • AutoMate's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 134
  • Karma: 0
Hi Claes,

My custom class module contains many parameter, including several boolean inputs, as shown. The class editor automatically adds invert selections for each boolean input (a very nice feature).

Proview_Boolean_Invert.png


Simple code is used to read connected input values to a local variable for use in a program. This method has two advantages: 1) connected input values can be seen updating in trace mode from an object editor. 2) Program variable names are consistent, whether externally connected or not. The downside may be more CPU horsepower required per point?


Proview_Bypass.png



The question is how to check the invert parameter for each input? It is not automatically handled. I find no invert parameter references in the custom_class.wb_load file, the custom_class.h file or the class help .

I have been searching through the source code to see how standard logic gates (AND, OR) are handled. Eventually, wb_gcg.cpp and rt_plc_macro_logic.h were discovered. This C++ code is extremely tight and clever with common subroutines used by many function blocks. Of particular interest, gcg_print_inputs checks for connected inputs and invert selections. I do not fully understand it yet, but can appreciate the eloquence.

Would you provide an example line of code showing a simple way to check the status of a boolean invert
parameter for a custom class?

/Ron
Attachments:
Last Edit: 6 years 7 months ago by AutoMate. Reason: Attachment Error
The administrator has disabled public write access.

Compile from source with new classes 6 years 7 months ago #8300

  • AutoMate
  • AutoMate's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 134
  • Karma: 0
More research reveals inverted inputs may not be supported on custom class objects?

Inverted_Inputs_Not_Allowed.png


No big deal. Inputs are easily inverted in PLC function blocks, if needed. Also, a separate invert selection array could be built if really required (which in this case is not).

/Ron
The administrator has disabled public write access.

Compile from source with new classes 6 years 7 months ago #8301

  • claes
  • claes's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 3063
  • Karma: 0
Hi Ron,

Inverted inputs are not supported on objects where the code is defined by a c function, they can only be used on objects where the code is defined by a macro. It is possible to define a custom class with a macro by setting the compile method to 5 instead of 4, and include the macro in ra_plc_user.h.

For classes with c-function the invert checkbox can be removed by setting the noinvert bit in $Input.Flags.

/Claes
The administrator has disabled public write access.
The following user(s) said Thank You: AutoMate
Time to create page: 0.601 seconds