Page 4 of 4

Re: Development version shape library

Posted: Wed May 05, 2021 11:41 am
by Les Newell
It needs to be inside the function. x and y need to be set to the x and y coordinates of the centroid of the shape.

Re: Development version shape library

Posted: Wed May 05, 2021 3:15 pm
by David_Lelen01
Heck yea, that fixed it! Thanks! Works exactly as I intended now. Or seems to at the moment anyways. I really wish I had the time to learn how to code better... seems like I know just enough to be dangerous and annoying lol

Re: Development version shape library

Posted: Thu May 20, 2021 12:13 pm
by David_Lelen01
Hey Les, some of the comments in the shape files say a line of zero length creates a point but i am not getting anything any points being created. I wanted to add a point shape so i could use the drill operation to just make a pierce hole to locate holes that need to be machine drilled or something.

Here is the code:

Code: Select all

Circle(shape.X, shape.Y, 20)
	Line(shape.X, shape.Y, shape.X, shape.Y)
I first tried just the "Line(sh..." and got nothing so i tried putting in a circle that i know generates and the circle is added to the part, but not the line or point. Any thoughts what's causing this.

Re: Development version shape library

Posted: Fri May 21, 2021 10:31 am
by Les Newell
Huh. It looks like I lied. A zero size line will be ignored. You can however use a circle of zero diameter instead.

In the next release I'll add a Point function. You can add it to your version if you want:

Run SheetCam as administrator then go to Options->plugin options->shape and click on the 'Edit macro" button.
Add this function:

Code: Select all

function Point(x, y)
   Circle(x, y, 0)
end
It doesn't matter where you place it but for consistency I'd add it just after function Circle. This addition will be in the next release.

Now you can use Point(shape.X, shape.Y) to generate a point. Note that points won't show up until you add the shape to your part.

Re: Development version shape library

Posted: Sat Aug 28, 2021 8:17 pm
by robertspark

Code: Select all

--Circle(x, y, diameter) -- circle
--Line( x1, y1, x2, y2) -- Line from X1, Y1 to X2, Y2
--MoveTo( x, y) -- Set Current Position
--LineTo(x , y) -- Line from current position to X, Y.
--ArcA(startX, startY, CentreX, centreY, angle) -- angle in Radians, Positive Angle Clockwise

-- line with zero length = "point"

-- SHAPE NAME: Donut

shape = {}

function shape.Calculate()
   local dd1 = shape.diameter1
   local dd2 = shape.diameter2
    
	Circle(0, 0, dd1)
	Circle(0, 0, dd2)
	
 end

AddNumControl("diameter1", TR("Inside Diameter"), sc.unitLINEAR, 50.8, 0.0254, 6096, "insidediameter.png")
AddNumControl("diameter2", TR("Outside Diameter"), sc.unitLINEAR, 101.6, 0.0254, 6096, "outsidediameter.png")
I noticed that the images (insidediameter + outsidediameter) are not showing up when clicking on the textbox to edit the dims in the current development version [7.1.7] (not sure when they stopped working though).

Re: Development version shape library

Posted: Mon Aug 30, 2021 12:01 pm
by Les Newell
Hmm, you're right. I'll try to fix it for the next release.

Re: Development version shape library

Posted: Fri Nov 19, 2021 4:50 pm
by David_Lelen01
Hey Les, I added some more shapes to the library and fixed/added some of the bitmaps and icons. I have attached my latest version of the shape library if you would like to incorporate it into the next release.

Also, something appears to still be wrong with the bitmaps showing in the shape window. The icons are displaying in the dialog fine, but none of the explanatory bitmaps are showing in the shape window when you click a box to edit.

Re: Development version shape library

Posted: Sat Nov 20, 2021 12:17 pm
by robertspark
thanks for taking the time to continue this work

Re: Development version shape library

Posted: Sun Nov 21, 2021 11:06 am
by Les Newell
Thanks for the update. I think I know what is going on with the icons so I should have it fixed for the next release.

Re: Development version shape library

Posted: Mon Nov 22, 2021 12:18 pm
by David_Lelen01
No problem, just glad I can help out in some way other than come up with problems lol