- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
Originally, autocad did not allow you to insert two or more VisibilityParameters into a block. I'm trying to get around this obstacle as follows.
I create a block and enter a VisibilityParameters manually, then copy it using code.
I managed to copy, but when I closed the blockeditor the parameter disappeared.
CODE:
Public Sub TESTE2() Dim res As PromptSelectionResult = VBCad.Application.SelectObjectsOnscreen() Dim sel As SelectionSet = res.Value Dim acDoc As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument Dim acCurDb As Database = acDoc.Database Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction() Dim acBlkTbl As BlockTable = acTrans.GetObject(acCurDb.BlockTableId, OpenMode.ForRead) Dim acBlkTblRec As BlockTableRecord = acTrans.GetObject(acBlkTbl(BlockTableRecord.ModelSpace), OpenMode.ForWrite) For Each e As SelectedObject In sel Dim acEnt As Entity = acTrans.GetObject(e.ObjectId, OpenMode.ForWrite) Dim c As Internal.DatabaseServices.BlockElementEntity = acEnt.Clone acBlkTblRec.AppendEntity(c) acTrans.AddNewlyCreatedDBObject(c, True) Next acTrans.Commit() End Using End Sub
Is there a better way to do it?
Solved! Go to Solution.
Link copied