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

this code fails to Filling the hatch after selecting a point

0 REPLIES 0
Reply
Message 1 of 1
ankitagarwal
214 Views, 0 Replies

this code fails to Filling the hatch after selecting a point

I used this code to fill the hatch boundary after selecting a point but it does not work properly it gives message "Hatch boundary Associativity removed "
Can any one helpme to solve this problem

Public Function FillHatch(ByVal hatchname As String, ByVal pt As Point3d) As ObjectId
Dim hatid As ObjectId
Dim doc As Document = Application.DocumentManager.MdiActiveDocument
Dim db As Database = Application.DocumentManager.MdiActiveDocument.Database
Dim tm As DBTransMan = db.TransactionManager
Dim ta As Transaction = tm.StartTransaction()
Dim LT As LayerTable = ta.GetObject(db.LayerTableId, OpenMode.ForRead, False)
Dim ed As Editor = doc.Editor
Using ta
Try
Dim htpoint1 As New Point3d(pt.X - 0.1, pt.Y - 0.1, 0)
Dim bt As BlockTable = tm.GetObject(db.BlockTableId, OpenMode.ForRead, False)
Dim btr As BlockTableRecord = tm.GetObject(bt(BlockTableRecord.ModelSpace), OpenMode.ForWrite, False)

Dim rb As ResultBuffer = New ResultBuffer
rb.Add(New TypedValue(5005, "._-BOUNDARY"))
rb.Add(New TypedValue(5005, "_AD"))
rb.Add(New TypedValue(5005, "_IS"))
rb.Add(New TypedValue(5005, "_n"))
rb.Add(New TypedValue(5005, ""))
rb.Add(New TypedValue(5005, "_OB"))
rb.Add(New TypedValue(5005, "PO"))
rb.Add(New TypedValue(5005, ""))
rb.Add(New TypedValue(5005, (htpoint1.X.ToString + ("," + htpoint1.Y.ToString))))
rb.Add(New TypedValue(5005, ""))

acedCmd(rb.UnmanagedObject)
Dim selecEnt As PromptSelectionResult = ed.SelectLast
Dim sset As SelectionSet = selecEnt.Value
Dim blkIDs() As ObjectId = sset.GetObjectIds()
Dim ht As New Hatch
ht.LinetypeScale = 4.0
hatid = btr.AppendEntity(ht)
tm.AddNewlyCreatedDBObject(ht, True)
Dim ids As ObjectIdCollection = New ObjectIdCollection()
ids.Add(blkIDs(0))
ht.Associative = False
ht.AppendLoop(HatchLoopTypes.Default, ids)
btr.DowngradeOpen()
ids.Add(hatid)
Dim dot As DrawOrderTable = CType(tm.GetObject(btr.DrawOrderTableId, OpenMode.ForWrite), DrawOrderTable)
dot.MoveToBottom(ids)
ta.Commit()
Finally
ta.Dispose()
End Try
End Using
Return hatid
End Function
Private Declare Function acedCmd Lib "acad.exe" Alias "acedCmd" (ByVal vlist As System.IntPtr) As Integer
0 REPLIES 0

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