谢谢,学习时知道边界首尾相边,但没想到用弧代替圆。又学到一招,希望能多交流。再次谢谢! Private Sub Command1_Click() A=2:B=1 Dim hatchObj As AcadHatch, patternName As String, PatternType As Long Dim bAssociativity As Boolean, inloop(0 To 4) As AcadEntity patternName = "SOLID" PatternType = 0 bAssociativity = False
Set hatchObj = Acadapp.ActiveDocument.ModelSpace.AddHatch(PatternType, patternName, bAssociativity) ' 为阴影创建外部边界 p2(0) = 0: p2(1) = 0 Set inloop(0) = Acadapp.ActiveDocument.ModelSpace.AddLine(p2, inpnt) p1(0) = A / 2 - B / 6 * Cos(PI / 4): p1(1) = -B / 2 - B / 6 * Sin(PI / 4) Set inloop(1) = Acadapp.ActiveDocument.ModelSpace.AddLine(inpnt, p1) p1(0) = A / 2: p1(1) = -B / 2 Set inloop(2) = Acadapp.ActiveDocument.ModelSpace.AddArc(p1, B / 6, PI / 4, PI * 5 / 4)'更改为这样就行了。 p1(0) = A * 3 / 6 + B / 6 * Cos(PI / 4): p1(1) = -B / 2 + B / 6 * Sin(PI / 4) Set inloop(3) = Acadapp.ActiveDocument.ModelSpace.AddLine(p1, inpnt2) p1(0) = 0: p1(1) = 0 Set inloop(4) = Acadapp.ActiveDocument.ModelSpace.AddLine(inpnt2, p1) hatchObj.AppendOuterLoop (inloop) hatchObj.Evaluate End Sub |