.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Can't hatch multiple arc & line boundaries.

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
quigs
1014 Views, 4 Replies

Can't hatch multiple arc & line boundaries.

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

My name is Martin.. 😄
4 REPLIES 4
Message 2 of 5
Irvin
in reply to: quigs

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

Message 3 of 5
quigs
in reply to: Irvin

i Irvin,

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

 

Regrads,

 

Martin.

My name is Martin.. 😄
Message 4 of 5
quigs
in reply to: quigs

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.

My name is Martin.. 😄
Message 5 of 5
Irvin
in reply to: quigs

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost