Hi folks,
I have a series of call-outs where when the text shape is selected, I want to figure out the "parent" call-out shape.
It doesn't help that I tend to find CustomShapes a bit opaque as it is, but I can't seem to identify a way to get the parent. Any suggestions, or can I not get there from here?
Adjacent to that, is there a way to set the target on a Callout, or is that something handled internally by Designer? I like how the call-out connects to the shape, but it's something I can't seem to reproduce in my code.
Thanks in advance!
My method is to use auxiliary line control segments instead of directly binding dimension objects.
Replying to myself, I think I may have figured out a solution to this, though I'm not sure this is the cleanest.
With the text item in the call-out selected, I iterante through all the CustomShapes and check the location of their Custom.TextShape against my selection. If the positions match then I consider that I have my candidate.
Connector, dimension, callout use SnapPoint to connect to a shape
[CgsAddInMacro] public void CreateConnector() { Layer l = corelApp.ActiveDocument.ActiveLayer; corelApp.ActiveDocument.BeginCommandGroup(); Shape el = l.CreateEllipse2(0, 0, 5); Shape text = l.CreateArtisticText(20, 10, "Ellipse"); SnapPoint elP = el.SnapPoints.FindClosest(cdrPointType.cdrSnapPointObject, el.RightX, el.CenterY); SnapPoint textP = text.SnapPoints.FindClosest(cdrPointType.cdrSnapPointObject, text.LeftX, text.CenterY); Shape con = l.CreateConnector(elP, textP); corelApp.ActiveDocument.EndCommandGroup(); } [CgsAddInMacro] public void CreateDimension() { Layer l = corelApp.ActiveDocument.ActiveLayer; corelApp.ActiveDocument.BeginCommandGroup(); Shape polly = l.CreatePolygon2(0,0,20,3,0); l.CreateLinearDimension(cdrLinearDimensionType.cdrDimensionHorizontal, polly.SnapPoints[1], polly.SnapPoints[3],TextY: polly.TopY+5,TextSize:10d ); l.CreateLinearDimension(cdrLinearDimensionType.cdrDimensionHorizontal, polly.SnapPoints[3], polly.SnapPoints[4],TextY: polly.TopY+25,TextSize:10d ); SnapPoint sL = polly.SnapPoints.AddUserSnapPoint(polly.LeftX + 4, polly.BottomY + 4); SnapPoint sR = polly.SnapPoints.AddUserSnapPoint(polly.RightX - 4, polly.BottomY + 4); l.CreateLinearDimension(cdrLinearDimensionType.cdrDimensionHorizontal, sL, sR, TextY: polly.TopY + 15, TextSize: 10d); corelApp.ActiveDocument.EndCommandGroup(); }