DrawingViewHatchArea.Rangebox does not respect Break Operations

DrawingViewHatchArea.Rangebox does not respect Break Operations

J-Camper
Advisor Advisor
165 Views
1 Reply
Message 1 of 2

DrawingViewHatchArea.Rangebox does not respect Break Operations

J-Camper
Advisor
Advisor

I have a script that adds material leaders to each hatch region.  When I'm selecting which drawing curve to connect to I want to avoid drawing curves of the surfacebody which do not bound the hatch region.  To do this I am checking if the points of the drawing curves are within the Rangebox of the HatchArea.  This works well in most situations except when the drawing view has any break operations

 

I have found out that the rangebox of the hatcharea can be outside of the DrawingView boundary when the DrawingView has a break operation.  Unfortunately this does not align with the drawing curves as they do respect the break operation, so I'm not able to filter DrawingCurves for DrawingViews with Break operations.  I feel like this should not be the intended behavior.

 

This is a simple test:

Sub Main
	
	Dim PickThis As DrawingView = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingViewFilter, "Select")
	If IsNothing(PickThis) Then Exit Sub ' If nothing gets selected then we're done
	
	Dim DVbox As Box2d = GetBoxFromView(PickThis)
	DVbox.Expand(.001) 'increases by .001 cm in each direction because Area Rangeboxes @ edges of view sometimes return false when "Exact" box is used

	For Each DVHR As DrawingViewHatchRegion In PickThis.HatchRegions
		Dim BoundaryGeometries As ObjectCollection
		Try
			BoundaryGeometries = DVHR.BoundaryGeometries
		Catch
			Continue For 'This is the only way to avoid the extra HatchRegions. Throws error instead of returning nothing when the "HatchRegion" doesn't actual bound a hatch region
		End Try
			
		Try
			For Each HA As DrawingViewHatchArea In DVHR.HatchAreas 
				Dim tempBox As Box2d = HA.RangeBox.Copy
				Logger.Trace(String.Format("MinPoint inside view: {1} | MaxPoint inside view: {2} | Area SurfaceBody name: {0}", DVHR.SurfaceBody.Name, DVBox.Contains(tempBox.MinPoint), DVBox.Contains(tempBox.MaxPoint)))
			Next
		Catch : End Try
	Next
		
End Sub

Function GetBoxFromView(parentDrawingView As DrawingView) As Box2d
	Dim MinPoint, MaxPoint As Point2d

	MinPoint = parentDrawingView.Center.Copy
	MinPoint.X -= parentDrawingView.Width / 2
	MinPoint.Y -= parentDrawingView.Height / 2

	MaxPoint = MinPoint.Copy
	MaxPoint.X += parentDrawingView.Width
	MaxPoint.Y += parentDrawingView.Height

	GetBoxFromView = ThisApplication.TransientGeometry.CreateBox2d
	GetBoxFromView.MinPoint = MinPoint
	GetBoxFromView.MaxPoint = MaxPoint

	Return GetBoxFromView
End Function

it should return all true for views which do not have any break operations, but returns some false if there are break operations.

 

I would like to know if anyone can think of a workaround, and more importantly if this is even supposed to be the intended behavior.

0 Likes
166 Views
1 Reply
Reply (1)
Message 2 of 2

J-Camper
Advisor
Advisor

@johnsonshiue,

I appreciate you help with the material leaders issue I've been seeing.  Would you mind looking into this for me?

The drawing curve location changes with break operations, but the Hatch Regions don't appear to be following the same behavior.  I'm not sure if this is intended due to limitations, or if this is not the intended behavior since other objects respect the break operations.

0 Likes