Development version shape library
-
- Posts: 452
- Joined: Wed Sep 12, 2018 8:18 pm
- Location: South Carolina, USA
- Contact:
Re: Development version shape library
What's your timeline looking like for the next stable release? With the flood of projects around the holidays, I haven't had much time to work on the new shapes I mentioned.
- Les Newell
- Site Admin
- Posts: 3668
- Joined: Thu May 11, 2006 8:12 pm
Re: Development version shape library
At the rate things are going I'd say around the end of January. I had hoped to have things a bit more settled by now.
-
- Posts: 452
- Joined: Wed Sep 12, 2018 8:18 pm
- Location: South Carolina, USA
- Contact:
Re: Development version shape library
Hey Les, working on a few more shapes here and i think i am running into some issues with your location code for the shapes. This isn't behaving anything like I expected. I expected to set the X,Y location to 0,0 and The coordinates would be whatever i type in X1, Y1, X2, Y2, but the line is totally dependent on the X,Y location input somehow. Can you see what is going on here?
Also, i dont remember if the update has been released yet or not, i dont think it has, but the X position on the text plugin is still doing something wonky and the shape plugin X,Y are not auto-updating.
Code: Select all
function shape.Calculate()
MoveTo(shape.X1, shape.Y1)
Line(shape.X1, shape.Y1, shape.X2, shape.Y2)
end
- Les Newell
- Site Admin
- Posts: 3668
- Joined: Thu May 11, 2006 8:12 pm
Re: Development version shape library
The datum for the X,Y coordinates is always the centre of the outline of your shape. In your example the datum point would be half way between X1,Y1 and X2,Y2.David_Lelen01 wrote: ↑Fri Apr 30, 2021 12:44 pm Hey Les, working on a few more shapes here and i think i am running into some issues with your location code for the shapes. This isn't behaving anything like I expected.
These are fixed for the next release. Stable should be out today. Dev will probably be out sometime next week.Also, i dont remember if the update has been released yet or not, i dont think it has, but the X position on the text plugin is still doing something wonky and the shape plugin X,Y are not auto-updating.
In shape, entering values in X and Y does work, it just doesn't update the display. If you force a redraw, for example by zooming in or out you it will be shown in the correct place.
-
- Posts: 452
- Joined: Wed Sep 12, 2018 8:18 pm
- Location: South Carolina, USA
- Contact:
Re: Development version shape library
That still does not explain the behavior i am seeing, unless i just totally dont understand something here. It seems to me it is completely ignoring my X1, Y1 Point and trying to generate the line off of the center point. And not all of the shape main.lua codes use the centroid as the origin of the shape, so how does that work? I think i need to know more about how your datum point works to make this shape work correctly.The datum for the X,Y coordinates is always the centre of the outline of your shape. In your example the datum point would be half way between X1,Y1 and X2,Y2.
- Les Newell
- Site Admin
- Posts: 3668
- Joined: Thu May 11, 2006 8:12 pm
Re: Development version shape library
When you create a shape it is normalised so that X0Y0 is the centroid. The part coordinates are then added to set the final position.
Are you trying to position your shape at an absolute position on the sheet?
Are you trying to position your shape at an absolute position on the sheet?
-
- Posts: 452
- Joined: Wed Sep 12, 2018 8:18 pm
- Location: South Carolina, USA
- Contact:
Re: Development version shape library
Yeah, thats exactly my intent. I was trying to make a line that i could place at an exact location. Not sure how i could do that if every shape is normalized. It would work, you would just have to calculate the centroid when placing the shape instead of starting a line on a known point and going from there like i intended.Are you trying to position your shape at an absolute position on the sheet?
- Les Newell
- Site Admin
- Posts: 3668
- Joined: Thu May 11, 2006 8:12 pm
Re: Development version shape library
It wasn't really designed to work in absolute positioning. How come it doesn't surprise me you're trying to get it to do something it wasn't designed to do?
Re: Development version shape library
I don't use shapes, but can't you just put a formula in the post to calculate the center of the shape and offset the alignment?
-
- Posts: 452
- Joined: Wed Sep 12, 2018 8:18 pm
- Location: South Carolina, USA
- Contact:
Re: Development version shape library
Me?? Try to make something do something it was never intended to do? I wouldn't dare! lol Idk, that's kinda my job, Les lol.It wasn't really designed to work in absolute positioning. How come it doesn't surprise me you're trying to get it to do something it wasn't designed to do?
Maybe its worth considering redesigning for absolute positioning. Every single time i have used the shape library i always have a specific position and rotation i want it on the sheet. Hopefully some others will chime in with their opinions.
That is possibly an option, but i am not sure if it would simplify what i am trying to do any. I am trying to place a shape in a specific position relative to other geometry already on the sheet layout. yes, im sure it could be done in the post, but it would be far easier to just use the nesting and alignment functions already in sheetcam. I am just hoping to simplify the process of doing it in sheetcam to one step.I don't use shapes, but can't you just put a formula in the post to calculate the center of the shape and offset the alignment?
- Les Newell
- Site Admin
- Posts: 3668
- Joined: Thu May 11, 2006 8:12 pm
Re: Development version shape library
The shape will always be normalised so the centroid is at 0,0. That is a part of the way SheetCam's internals work and it's not practical to change this.
However you should be able to force the shape position. At the end of shape.Calculate() add this:
tempObj:SetPosition2D(sc.Coord2D(x,y))
x and y are the absolute coordinates of the centroid of the shape.
Note this is untested so it may have unexpected side effects.
However you should be able to force the shape position. At the end of shape.Calculate() add this:
tempObj:SetPosition2D(sc.Coord2D(x,y))
x and y are the absolute coordinates of the centroid of the shape.
Note this is untested so it may have unexpected side effects.
-
- Posts: 452
- Joined: Wed Sep 12, 2018 8:18 pm
- Location: South Carolina, USA
- Contact:
Re: Development version shape library
I'll be glad to test it out for you Thanks Les!Note this is untested so it may have unexpected side effects.
-
- Posts: 452
- Joined: Wed Sep 12, 2018 8:18 pm
- Location: South Carolina, USA
- Contact:
Re: Development version shape library
Hey Les, So far, I have not been able to make that line of code do anything. the shape normalizing code must be overriding it or something.
- Les Newell
- Site Admin
- Posts: 3668
- Joined: Thu May 11, 2006 8:12 pm
Re: Development version shape library
It is moving the shape but it doesn't update the displayed coordinates. Try this instead:
Code: Select all
tempObj:SetPosition2D(sc.Coord2D(x,y))
posX.value:op_set(x)
posY.value:op_set(y)
posX.editor:GetValidator():TransferToWindow()
posY.editor:GetValidator():TransferToWindow()
-
- Posts: 452
- Joined: Wed Sep 12, 2018 8:18 pm
- Location: South Carolina, USA
- Contact:
Re: Development version shape library
That didn't exactly work either Les... Here's the error if it is inside the function block, which i think is wrong placement:
And here's if its placed after the function end:
and heres the code: