Author Topic: How to Delete polylines with in a block in entire drawing  (Read 1451 times)

0 Members and 1 Guest are viewing this topic.

chvnprasad

  • Guest
How to Delete polylines with in a block in entire drawing
« on: February 08, 2014, 04:08:26 PM »
Hi All,

I am new to dotnet.
Please any one help me to how to delete polyline within a Block by using C#.net.

« Last Edit: February 08, 2014, 04:13:33 PM by cvnp »

kaefer

  • Guest
Re: How to Delete polylines with in a block in entire drawing
« Reply #1 on: February 09, 2014, 12:13:53 PM »
Hi All,

I am new to dotnet.
Please any one help me to how to delete polyline within a Block by using C#.net.

I like this request, it's bold and not a little ambiguous. The straight-forward interpretation "delete a polyline which is nested in a block" needs more information to be practical: how would I identify a certain polyline inside a certain block?

To delete all polylines inside all blocks, including the layouts, you interate all objects in all blockdefinitions and see if they're polylines:

Code - F#: [Select]
  1. [<Autodesk.AutoCAD.Runtime.CommandMethod "DELPOLYS">]
  2. let DelPolys() =
  3.     let doc = Application.DocumentManager.MdiActiveDocument
  4.     use tr = doc.Database.TransactionManager.StartTransaction()
  5.     let bt = doc.Database.BlockTableId.GetObject OpenMode.ForRead :?> BlockTable
  6.     for btroid in bt do
  7.         let btr = btroid.GetObject OpenMode.ForRead :?> BlockTableRecord
  8.         for oid in btr do
  9.             match oid.GetObject OpenMode.ForRead with
  10.             | :? Polyline as pl ->
  11.                 pl.UpgradeOpen()
  12.                 pl.Erase()
  13.             | _ -> ()
  14.     tr.Commit()

The alternative interpretation is that you want to trim your polyline between the intersection points of it with some or all of the blocks elements, in which case more information is needed: how would I identify a certain polyline which intersects with certain elements inside a certain block? And why don't you just create a wipeout to achieve the same result?

chvnprasad

  • Guest
Re: How to Delete polylines with in a block in entire drawing
« Reply #2 on: February 10, 2014, 02:23:31 PM »
Hi kaefer,

Thanks for your positive response..

I requested you to below:

1) How to collect all poly lines which are  show inside the blocks.. In attached Drawing 2 blocks are shown (DT_TAP4 and DT_TAP8). if i give these two block names as input it need to collect all poly lines inside the  given blocks and need store in a variable.

If possible please convert your code to F# to C#, its hard to read F#, I know only c#