Can't hatch multiple arc & line boundaries.

Can't hatch multiple arc & line boundaries.

Anonymous
Not applicable
1,178 Views
4 Replies
Message 1 of 5

Can't hatch multiple arc & line boundaries.

Anonymous
Not applicable

Hi,

I am having trouble hatching multiple "Arc & line" boundary objects.  If there is ony 1 shape mape up of Arcs & Lines it works ok, but if there is more than one, it fails, any ideas why?

 

Cheers,

 

Martin.

 

 

 Dim TVLn(0) As TypedValue
                TVLn(0) = New TypedValue(0, "line")
                Dim FilterLn As New SelectionFilter(TVLn)
                ' Selection Filter: Arcs
                Dim TVArc(0) As TypedValue
                TVArc(0) = New TypedValue(0, "Arc")
                Dim FilterArc As New SelectionFilter(TVArc)

                ' Selection: Lines & Arcs
                Dim SelLines As PromptSelectionResult = acDoc.Editor.SelectWindow(New Point3d(BrdMin.X + 2.5, BrdMin.Y + 2.5, 0), New Point3d(BrdMax.X - 2.5, BrdMax.Y - 2.5, 0), acSelFtr)
                Dim SelArcs As PromptSelectionResult = acDoc.Editor.SelectWindow(New Point3d(BrdMin.X + 2.5, BrdMin.Y + 2.5, 0), New Point3d(BrdMax.X - 2.5, BrdMax.Y - 2.5, 0), FilterArc)
                If Not IsNothing(SelLines.Value) Or Not IsNothing(SelArcs.Value) = True Then

                    ' Lines grroup.
                    Dim LinesEnt As Entity
                    Dim EntCol As Double
                    Dim LinesCol As New ObjectIdCollection
                    For Each LinesID As ObjectId In SelLines.Value.GetObjectIds
                        LinesEnt = LinesID.GetObject(OpenMode.ForWrite)
                        Dim Lines As Line = LinesEnt
                        LinesCol.Add(Lines.ObjectId)
                        EntCol = LinesEnt.ColorIndex

                    Next
                    ' Arcs grroup.
                    For Each ArcsID As ObjectId In SelArcs.Value.GetObjectIds
                        Dim ArcsEnt As Entity = ArcsID.GetObject(OpenMode.ForWrite)
                        Dim Arcs As Arc = ArcsEnt
                        LinesCol.Add(Arcs.ObjectId)
                    Next
                    For Each LnArc As SelectedObject In LinesCol
                        '  For Each selObj In LinesCol
                        '' Hatch center peice
                        Dim HatchCntPce As Hatch
                        HatchCntPce = New Hatch()
                        acBlkTblRec.AppendEntity(HatchCntPce)
                        acTrans.AddNewlyCreatedDBObject(HatchCntPce, True)
                        HatchCntPce.SetHatchPattern(HatchPatternType.PreDefined, "solid")
                        HatchCntPce.AppendLoop(HatchLoopTypes.Default, LinesCol)
                        HatchCntPce.ColorIndex = EntCol
                        '    Next
                    Next
                End If

0 Likes
Accepted solutions (1)
1,179 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable

Hi Quigs,

 

For the “appendLoop” to succeed, the loop must be simple, closed, and continuous, intersecting itself only at its endpoints. 

 

If you need to create a 'Difficult'  hatch then you will have to use the BRep API to traverse the topology and call appendLoop to the define the loops for the hatch.

 

At the moment i havend got a sample i can share because i've got the same problem as you. But the Brep API is the way to go.

 

Perhaps Yuan can shine a light on how to use the BRep api.

 

Kind regards,

 

Irvin

0 Likes
Message 3 of 5

Anonymous
Not applicable

i Irvin,

Thanks for the response, I havent heard of the Brep API before but that does sound interesting.

 

Regrads,

 

Martin.

0 Likes
Message 4 of 5

Anonymous
Not applicable
Accepted solution

Hi Irvin,

I think I may have found a solution, but I haven't fully wrote it yet.  I am able to convert the closed objects of lines and arcs to regions.  Those regions are then hatchable.   Hope that helps you out,

 

Regards,

 

Martin.

0 Likes
Message 5 of 5

Anonymous
Not applicable

Unfortunately,

 

This whill not solve my problem because the entitys i need to hatch area regions with shapes cut out of them.

 

See is as regions like donuts. And these objects arent hatch able with the append loop.

 

But thanks.

 

Kind regards,

 

Irvin

0 Likes