Development version shape library

Having problems with or questions about SheetCam? Post them here.
User avatar
Les Newell
Site Admin
Posts: 3665
Joined: Thu May 11, 2006 8:12 pm

Re: Development version shape library

Post 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.
David_Lelen01
Posts: 452
Joined: Wed Sep 12, 2018 8:18 pm
Location: South Carolina, USA
Contact:

Re: Development version shape library

Post 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
David_Lelen01
Posts: 452
Joined: Wed Sep 12, 2018 8:18 pm
Location: South Carolina, USA
Contact:

Re: Development version shape library

Post 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.
User avatar
Les Newell
Site Admin
Posts: 3665
Joined: Thu May 11, 2006 8:12 pm

Re: Development version shape library

Post 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.
robertspark
Posts: 257
Joined: Thu Feb 26, 2015 12:11 am

Re: Development version shape library

Post 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).
User avatar
Les Newell
Site Admin
Posts: 3665
Joined: Thu May 11, 2006 8:12 pm

Re: Development version shape library

Post by Les Newell »

Hmm, you're right. I'll try to fix it for the next release.
David_Lelen01
Posts: 452
Joined: Wed Sep 12, 2018 8:18 pm
Location: South Carolina, USA
Contact:

Re: Development version shape library

Post 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.
Attachments
shapes.zip
(1.48 MiB) Downloaded 92 times
robertspark
Posts: 257
Joined: Thu Feb 26, 2015 12:11 am

Re: Development version shape library

Post by robertspark »

thanks for taking the time to continue this work
User avatar
Les Newell
Site Admin
Posts: 3665
Joined: Thu May 11, 2006 8:12 pm

Re: Development version shape library

Post 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.
David_Lelen01
Posts: 452
Joined: Wed Sep 12, 2018 8:18 pm
Location: South Carolina, USA
Contact:

Re: Development version shape library

Post by David_Lelen01 »

No problem, just glad I can help out in some way other than come up with problems lol
Post Reply