How to combine to shapes into one? Sketch - sketch-3

I have just installed sketch and I am trying to create a circle with a tick sign inside.
The issue is that whenever I use the Union option to merge the circle and tick sign the tick sign is hidden. Here are the steps.
Insert -> Shape -> Oval
Insert -> Vector
I draw the tick sign
Select all layers specified above and click on union.
Tick sign is no longer shown inside the circle.

You can select both and create a symbol. Then export the symbol. You don't need union for this since you don't have any of the two shapes protruding outside the other.

The union creates a newer shape with the outer boundaries of the elements. In your case, the check mark is inside the circle and the result is just the circle. The right operation would be:
1 convert the check mark into an outline (Shift + Cmd + O)
2 select the circle and the checkmark
3 use the option subtract so the new shape would be the circle minus the checkmark.

You can just Group the two layers in step 4, rather than Union. Wouldn't that accomplish what you're looking to do?

Related

Make a split in the middle of a worksheet

I am wanting to add a split vertically at Column I, basically splitting the worksheet into 2 halves. I want to be able to scroll up and down on the left half while the right half doesn't move and then move over to the right half and scroll up and down while the left half doesn't move.
I have tried "Split" but it doesn't work how I would like.
Select View > New Window.
Then do Win+LeftArrow on window1, and Win+RightArrow on window2.
Tada..
Hope it solves. ( :

How to get the correct left position of a shape within a group when using python-pptx?

I am parsing a simple PowerPoint with three shapes. One shape is visibly to the left of the two other. But not when comparing it using python-pptx. The right side of that left shape (shape.left+shape.width) has a higher value than one of the other shapes left side (shape.left). The python-pptx result seem to indicate the right-hand shape starts within the left-hand shapes border. This seem to be caused by the group shape the right-hand shape is within.
What is the proper code to compare correctly that the right-hand shapes left side in fact is to the right of the left-hand shape?
I have tried removing the group, and then comparisons show expected values. I have tried creating new group shapes with shapes within, and again, they show expected values. However, the linked PowerPoint file at www.mibnet.se/LeftBoxIssue.pptx is an example where the group shape affects the normal result. When running the code, I do not know how the shapes were created. I need a generic way to test this special case correctly.
from pptx import Presentation
from pptx.enum.shapes import MSO_SHAPE_TYPE
strStartPowerPoint=r".\LeftBoxIssue.pptx"
prs=Presentation(strStartPowerPoint)
slide=prs.slides[0]
for shpShape in slide.shapes:
if shpShape.shape_type == MSO_SHAPE_TYPE.GROUP:
print(shpShape.shapes[0].text+
" has Left="+str(shpShape.shapes[0].left)+
" and right="+
str(shpShape.shapes[0].left+shpShape.shapes[0].width))
else:
print(shpShape.text+" has Left="+str(shpShape.left)+
" and right="+str(shpShape.left+shpShape.width))
I expect the right hand shape to have its "left" value greater than the left-hand shapes "right" value. But instead, it prints a smaller value:
Left has Left=160326 and right=6254527
Right has Left=3291751 and right=3846370
A good place to start in understanding this is inspecting the group-shape XML:
print(group_shape._element.xml)
There you will find a child element that looks like this:
<p:grpSpPr>
<a:xfrm>
<a:off x="3347864" y="2204864"/>
<a:ext cx="3506688" cy="2930624"/>
<a:chOff x="3347864" y="2204864"/>
<a:chExt cx="3506688" cy="2930624"/>
</a:xfrm>
</p:grpSpPr>
The <a:chOff> element represents the "child-offset" of shapes within the group. In this case, which is typical of shapes grouped in python-pptx, note that the a:chOff values are exactly the same as the a:off values, which represent the top-left corner of the group-shape.
Using these two sets of values, you can calculate some interesting positions.
Absolute position of child shapes. This is child a:off plus group a:off minus group a:chOff.
Relative position of child shapes (to the group-shape origin). This is child a:off minus group a:chOff.
You can get these extra child-offset values from the group with:
chOff = group_shape._element.xpath("./p:grpSpPr/a:xfrm/a:chOff")[0]
chOff_x = int(chOff["x"])
chOff_y = int(chOff["y"])
These values are in English Metric Units (EMU) which are described here along with how you might conveniently manipulate them:
https://python-pptx.readthedocs.io/en/latest/user/autoshapes.html#understanding-english-metric-units
python-pptx always uses a child offset equal to the group shape position (a:off) because that is convenient. Other packages may use other group-shape offsets that are more convenient to their purposes. For example, if you were to move a group, you could accomplish that by changing a:off in the group only, without having to visit and update each of the child shape positions.

Is there a quick way to find the correct coordinate parameters for get_overlapping?

it's pretty tedious working out the dimensions of an image then halving it and adding it on every time I want to check whether something is overlapping.
You likely want to use bbox.
This 'returns the bounding box for all matching items', i.e. the rectangle outline of the picture you want to get the coordinates of.
coords = canvas.bbox(item)
or
coords = canvas.bbox("itemtag")
In the case of multiple items with the same tag, it will use the first item given that tag.

How to Subtract a Vector Path from a Rectangle in Sketch

How does one subtract a vector path in Sketch. Shapes are straightforward and text is also doable. The white lines in the attached images need to be cuts through the rectangle. Suggestions?
You need to convert the vector-path to outlines first.
Select the desired element with outlines
Choose inside the menu: Layer > Convert to Outlines (⇧⌘O)
Select the elements you want to combine
Choose (Subtract, Intersect or Difference)
Update: added an inline GIF for better visual reference

Overbraces in Excel

From Googling I've only found "regular" braces, i.e. } in varying sizes. I want to achieve an overbrace spanning some columns in a table. I only want the overbrace (where the brace "starting first" is an overbrace, and the latter an underbrace) and the x over it in the example is not needed.
Is there a way to achieve an overbrace in Excel?
Seems to me better suited to Super User but I am not sure I understand the requirement since you say you know abut "regular" braces. If you would like something like this:
show first with and lower down without the x, it may be achieved with insertion of a shape object: INSERT > Illustrations - Shapes, Right Brace in the case of Excel 2013.
Then rotating, stretching and moving the shape to suit, the handles for which are shown:
and colour adjusted with Shape Outline.

Resources