Gcode to tell a RepRap 3D printer he is in the middle of the heat bed? - g-code

Is there a way to tell a RepRap 3D printer that he is in the middle of a heatbed using a specific gcode?

You can set the coordinates to start at center (once you are already there) via G91:
G91: Set to Relative Positioning
Example: G91
All coordinates from now on are relative to the last position
from http://reprap.org/wiki/G-code#M117:_Get_Zero_Position

Related

Problem with Blenders Array Modifier to orbit or place in circular order (blender 3.0)

I was having the problem mentioned above and found that many of the tutorials are mentioning implementing the procedure on the centre of the canvas or world origin.
The question is how to perform that in any location successfully?
If you are familiar with blender the simple answer for you is - keep the Origins at the same place for both Centre and Orbital objects and make sure to apply the transforms.
For others-
Shift + Right-click to move the 3d Cursor to the desired location.
Create the Object that is to be Orbited or rotated.
Shape it as desired, then selecting that press Ctrl + A and press All Transforms,that will move it's origin to the world Origin, to correct that In object mode select the object and Rightclick then select Set Origin. and select the centre of mass to keep it in a visible field. (You can always edit your object in edit mode that will not destroy your array but minor modification will be required. ) (centring the origin isn't mandatory at this step, described to inform the process)
Place the 3d cursor at the point of the Orbital object from which it should face the centre. (to perform in complex object go to edit mode and select with vertex or edge or face selection and press Shift+S and select "Cursor to selected")
Having the cursor at desired point Create a cube or anything that will help to visualise the rotation. The cube will be exactly placed on the 3d cursor as well as its origin. Scale it as required. and apply all transforms as previous and reposition the origin to the 3D cursor.
Select the Orbital object and set its origin to the 3d cursor too.
If required provide some spacing to the Orbital object from the centre object (cube).
(but it will be helpful to visualize if you do that after creating the array, going to the edit mode of the orbital object)
Selecting the Orbital object assign Array modifier. Provide the desired number of objects under Count and make all axis of Relative offset 0 to get all orbital objects in the same plane. (relative offset comes pre-selected)
Tick Object Offset and with the Dropper select the Cube.
Now if the array doses strange things like the image below
It means either both of your Center and Orbital objects don't have origin At the same point (here 3d cursor) or You forgot to Apply the transforms for the objects.
Now you can rotate the cube to get the desired arrangement in circular form.
To provide the spacing from the centre object, go to the orbital object and press Tab for edit mode there selecting the original and move it along the upward axis allow you to have spacing. Because moving objects in edit mode don't affect the origin. that is still at the 3d cursor
Not only spacing you can do various formations rotating, moving the orbital object in edit mode.
Play with relative offset to get various looks.
The videos skim over setting origin and checking and re-checking transforms and origin points. This is a really important step and even following your detailed instructions it took a few tries to get it right.
This circular array modification is really tricky to get, but once learned it is a great tool for speeding up workflow.
Thanks for this

OpenGL: How to drag image and move it to the line by using the mouse

I want to drag an image to one line by using the mouse and when the image is close to the line, the image will automatically move on to the line, like some "floor planner" program ------------you create wall and drag the door to this wall and when the door is close to the wall, the door will automatically show up on the wall.
Can OpenGL do it?
if it can, can anyone tell me how? If it can not, can anyone tell me how I can do it?
Show me an example.
OpenGL is a rendering API, it's purpose is to generate rasterized images based on descriptions provided to it by an application.
It knows nothing about user input, and even less about the application's "domain objects" such as doors, walls, and so on. All it deals with is abstract coordinates and matrices that describe the transforms and projections to take those 3D coordinates into 2D for rasterization, as well as shading for surfaces and so on.
So, it's up to you to implement that, so that the coordinates you eventually pass to OpenGL end up being what you want them to be.
Snapping is typically a combination of measuring the distance to some guiding object, and the following quantization of the input coordinates to correspond to the the guide.

Drawing largers points with X11

I know X11 has XDrawPoints for drawing multiple points in a batch, but I'd like to have slightly larger points sometimes (useful if you're eg: drawing a line through them), but can't find any way to draw larger points without doing something kludgy like drawing a tiny filled rectangle, or zero-length line with endcaps.
Is there a reasonable way to set the point size that I'm missing?
A point is a single pixel in Xlib. But XFillArcs() would let you create a list of XArc structures that describe small circles. Then you can scale these circles to any radius by setting XArc.width and XArc.height.

Clipping Paths in Silverlight Mobile (WP7) - I can't create anything but a simple rectangle?

I'm trying to create clipping paths for shapes, such as circles, polygons, etc. I'm actually trying to make the clipping path follow the line of the shape. I've tried the below in Expression Blend, what am I missing? What I'm really trying to do here is have the user trace shapes with an InkPresenter, and have it error if they've drawn outside the lines X times... if Clipping Paths is the wrong way to go here, by all means please let me know what the correct direction is :)
I created a rectangle, rounded the edges until it was a circle and then Make Clipping Path was enabled. I select it and I get the error: "Rounded corners are not supported for clipping paths in Silverlight 4 Mobile and have been removed."
Then I created about 50 rectangles over the circle, then Make Compound Path... and now Make Clipping Path is disabled again
Then I left the 50 rectangles as just Rectangles and thought I'll just create each of them as a Clipping path... I do the first one, so far so good... I select the second and make it a Clipping Path for my InkPresenter, and it deletes my first Clipping Path and uses the second. Dead in the water, it looks like each object can only have one clipping path.
How do I get around this?
Tim
You can use a PathGeometry to create an arbitrary shape geometry that you can assign as Clip to your InkPresenter.
You can build up the points for the PathGeometry from input events as the user traces the shape.

Converting mouse position to world position OpenGL

Hey, I'm working on a map editor for my game, and I'm trying to convert the mouse position to a position in the game world, the view is set up using gluPerspective
A good place to start would be the function gluUnProject, which takes mouse coordinates and calculates object space coordinates. Take a look at http://nehe.gamedev.net/data/articles/article.asp?article=13 for a basic tutorial.
UPDATE:
You must enable depth buffering for the code in that article to work. The Z value for mouse coordinates is determined based on the value in the depth buffer at that point.
In your initialization code, make sure you do the following:
glEnable(GL_DEPTH);
A point on the screen represents an entire line (an infinite set of points) in 3D space.
Most people with questions similar to yours are really trying to select an object by clicking on it. If that's what you're after, OpenGL offers a selection mode that's generally more effective than trying to convert the screen coordinate into real-world coordinates.
Using selection mode is (usually) pretty simple: you start with gluPickMatrix, which you use to specify a small box around the click point. You then draw your scene in selection mode. When you're done, instead of actually drawing anything, it gives you back records of what would have been drawn in the box you specified. If memory serves, those are arranged in Z order, so the first one in the list is what would have displayed front-most (i.e., the one you usually want).

Resources