Hello,How to create triangle with sides 3, 5, 6 cm using CreatePolygon or one other way using VBA?Greetings?
Geometry 6th grade of secondary school
Sub CreateTriangle_3_5_6cm() Dim s As Shape, s1 As Shape, s2 As Shape, cpR As CrossPoints Dim a As Double, b As Double, c As Double, X As Double, Y As Double ActiveDocument.Unit = cdrMillimeter a = 60 b = 50 c = 30 Set s = ActiveLayer.CreateLineSegment(50, 50, 50 + a, 50) Set s1 = ActiveLayer.CreateEllipse2(100, 100, b, b) s1.ConvertToCurves Set s2 = ActiveLayer.CreateEllipse2(100, 100, c, c) s2.ConvertToCurves s1.CenterX = s.Curve.Nodes(1).PositionX s1.CenterY = s.Curve.Nodes(1).PositionY s2.CenterX = s.Curve.Nodes(2).PositionX s2.CenterY = s.Curve.Nodes(2).PositionY
Set cpR = s1.Curve.SubPaths(1).GetIntersections(s2.Curve.SubPaths(1), cdrAbsoluteSegmentOffset) X = cpR.Item(2).PositionX Y = cpR.Item(2).PositionY s1.Delete s2.Delete Set s1 = ActiveLayer.CreateLineSegment(s.Curve.Nodes(1).PositionX, s.Curve.Nodes(1).PositionY, X, Y) Set s2 = ActiveLayer.CreateLineSegment(s.Curve.Nodes(2).PositionX, s.Curve.Nodes(2).PositionY, X, Y)End SubGet in touch if you need anythingBest regardsTaras
Thank You for this answer!