Jump to content

insert shape function


Kpotmake

Recommended Posts

I'm trying to draw a pattern on a screen with the insert shape function, and so far everything is working, but I would like to know where I could find some documentation on these functions? They don't seem to be included in the help file.

I did open the example project 'draw_shape', and this has been helpfull in creating the first setup, but there are still a lot of questions left unanswered.

For instance:

-What is the maximum amount of shapes per group before I receive the error message from the insert shape function block 'maximum shapes reached' (error -8)?

-When is the shape inserted in the group? On the rising edge of the input or does it keep adding shapes as long as the input is high? Same question for draw shape group function block

-What is the maximum thickness for a line / rectangle before I receive the error message -2? Edit: seems to be 10

-Is it possible to create a solid circle / rectangle instead of just the border lines? Edit: since I haven't received any replies I made a loop that creates an increasingly smaller triangle / circle to fill the shape

-Are the available colors defined somewhere? Edit: the color codes seem to be HTML color codes (https://htmlcolorcodes.com/)

 

To anyone who wishes to implement this function, this is what I have found out so far: When you want to draw a grid from a data table (this was the case for me), when you want to loop through the data table to copy the X0 X1 Y0 Y1 coordinates from the data table to the shape line, you must include the status of the clear, insert shape and draw functions as a requirement before inserting a new shape (last insert / clear / draw must be finished before starting a new action), don't insert / clear / draw a new shape if status is <> 0. Also I found it worked flawlessly if I only trigger the function block once, so immediatly reset the starting condition once the insert shape function block is busy (again, you can monitor if it's busy by checking status <> 0). The easiest way to achieve this is with a state machine

Link to comment
Share on other sites

@Flex727, thanks for pinging me!
@Kpotmake--apologies. I see that there is in fact no documentation for Draw Shapes, and I will include this in a future release--thank you for drawing my attention to this.

For now, I can answer some of your questions:

  • >-What is the maximum amount of shapes per group before I receive the error message from the insert shape function block 'maximum shapes reached' (error -8)?>

You can include a total of 4 groups with 128 shapes in each one .

  • >-When is the shape inserted in the group? On the rising edge of the input or does it keep adding shapes as long as the input is high? Same question for draw shape group function block

When the Ladder Element 'Insert shape' is called and status =0 
 
insert shape.png

 

  • -What is the maximum thickness for a line / rectangle before I receive the error message -2? Edit: seems to be 10

Correct--10

  • -Is it possible to create a solid circle / rectangle instead of just the border lines? Edit: since I haven't received any replies I made a loop that creates an increasingly smaller triangle / circle to fill the shape

No, it is not possible

Yes, they are: 
HEX color code (https://www.w3schools.com/colors/colors_hexadecimal.asp)

 

Hope this helps!

 

Link to comment
Share on other sites

On 11/29/2021 at 5:39 PM, Cara Bereck Levy said:

@Flex727, thanks for pinging me!
@Kpotmake--apologies. I see that there is in fact no documentation for Draw Shapes, and I will include this in a future release--thank you for drawing my attention to this.

For now, I can answer some of your questions:

  • >-What is the maximum amount of shapes per group before I receive the error message from the insert shape function block 'maximum shapes reached' (error -8)?>

You can include a total of 4 groups with 128 shapes in each one .

  • >-When is the shape inserted in the group? On the rising edge of the input or does it keep adding shapes as long as the input is high? Same question for draw shape group function block

When the Ladder Element 'Insert shape' is called and status =0 
 
insert shape.png

 

  • -What is the maximum thickness for a line / rectangle before I receive the error message -2? Edit: seems to be 10

Correct--10

  • -Is it possible to create a solid circle / rectangle instead of just the border lines? Edit: since I haven't received any replies I made a loop that creates an increasingly smaller triangle / circle to fill the shape

No, it is not possible

Yes, they are: 
HEX color code (https://www.w3schools.com/colors/colors_hexadecimal.asp)

 

Hope this helps!

 

Thanks!

 

to anyone who wishes to create a solid shape: What you need to do is create a loop that runs something like this (in case of a circle, rectangle is somewhat similar):

Create a tag lineThickness, init value 10

Creat a tag idx (index for keeping track of the loop count)

On the first line the shape radius must be set to: DesiredRadius - LineThickness

Then subtract from the radius: idx * linethickness

then increment idx and repeat the loop untill the radius < linethickness

 

same applies for rectangle, except you need to apply this to width and height instead of radius

  • Like 1
Link to comment
Share on other sites

  • 3 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...