如果您想完全技术化,则在平面中为90,在平面中为-90。尝试一下。如果它是world ucs,可能想加入一个布尔值,并相应地删除末尾的旋转。
- 'Get the hatch
- Set HatchObj = ThisDrawing.ModelSpace.Item(ThisDrawing.ModelSpace.Count - 1)
- 'and the bounding box
- HatchObj.GetBoundingBox Pnt1, Pnt2
- 'create new UCS
- If ThisDrawing.GetVariable("WORLDUCS") = 1 Then
- With ThisDrawing
- Set UCSOrg = .UserCoordinateSystems.Add( _
- .GetVariable("UCSORG"), _
- .Utility.TranslateCoordinates(.GetVariable("UCSXDIR"), acUCS, acWorld, 0), _
- .Utility.TranslateCoordinates(.GetVariable("UCSYDIR"), acUCS, acWorld, 0), _
- "whirled")
- End With
- Else
- Set UCSOrg = ThisDrawing.ActiveUCS
- End If
- 'set the vectors
- XAx(0) = Pnt1(0) + 12: XAx(1) = Pnt1(1): XAx(2) = 0#
- YAx(0) = Pnt1(0): YAx(1) = Pnt1(1) + 12: YAx(2) = 0#
- 'set the new UCS
- Set NewUCS = ThisDrawing.UserCoordinateSystems.Add(Pnt1, XAx, YAx, "temp")
- ThisDrawing.ActiveUCS = NewUCS
- 'set a constant scale (we can change this to what is needed)
- HatchObj.PatternScale = 48
- 'make the pattern angle
- HatchObj.PatternAngle = Int((48 * Rnd) + 1)
- 'assign the changes
- HatchObj.Evaluate
- 'update the object
- HatchObj.UpDate
- 'reset the origin
- ThisDrawing.ActiveUCS = UCSOrg
- 'delete the temp origin
- ThisDrawing.UserCoordinateSystems.Item("temp").Delete
|