I can insert the block with my program. However I don't know how to accept the default values for the tags. I do not want to edit the attributes, I just want to accept the defaults.
Just set the system variables ATTDIA, and ATTREQ to 0 When you insert the block.
Remember to set them back to the previous setting when done.
That doesn't seem right. If you explode the block, then it is no longer a block, and no reason to have attributes in the first place. If that is what you want, then cool, but if not, then maybe if you post the code, people could help you out with a better solution.
En la guia de Autodesk hay un ejemplo:
<CommandMethod("AddBlockRef2")> _ Public Sub AddBlockRef2() ' Obtener el documento y la base de datos activos Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument Dim acCurDb As Database = acDoc.Database ' Obyener el nombre del bloque Dim acPr As PromptResult acPr = acDoc.Editor.GetString(ControlChars.Lf & "Indique el nombre del bloque: ") If acPr.Status <> PromptStatus.OK Then Return End If ' Iniciar una transaccion Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction() ' Abrir la tabla para bloques en modo lectura Dim acBlkTbl As BlockTable acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId, OpenMode.ForRead) ' Comprobar si el bloque existe If acBlkTbl.Has(acPr.StringResult) Then ' Abrir el registro del bloque de Espacio Modelo para escritura Dim acBlkTblRec As BlockTableRecord acBlkTblRec = acTrans.GetObject(acBlkTbl(BlockTableRecord.ModelSpace), _ OpenMode.ForWrite) ' Obtener una referencia del bloque Dim acBlk As BlockTableRecord = acTrans.GetObject( _ acBlkTbl.Item(acPr.StringResult), OpenMode.ForRead, False) ' Crear una referencia a bloque Dim acBlkRef As New BlockReference(New Point3d(50, 50, 0), acBlk.ObjectId) ' Rotar 45º ' 45 *(Math.PI/180) acBlkRef.Rotation = 0.785 ' Factor de escala acBlkRef.ScaleFactors = New Scale3d(50) ' Añadir el nuevo objeto al registro de la tabla para bloques ' y a la transaccion acBlkTblRec.AppendEntity(acBlkRef) acTrans.AddNewlyCreatedDBObject(acBlkRef, True) ' Si el bloque contiene atributos, añadirlos a la referencia a bloque If acBlk.HasAttributeDefinitions Then For Each acObjId As ObjectId In acBlk Dim acObj As DBObject = acTrans.GetObject(acObjId, OpenMode.ForRead, False) Dim acAttDef As AttributeDefinition = TryCast(acObj, AttributeDefinition) If acAttDef IsNot Nothing Then If Not acAttDef.Constant Then ' Crear una referencia de atributo Dim acAttRef As AttributeReference = New AttributeReference acAttRef.SetAttributeFromBlock(acAttDef, acBlkRef.BlockTransform) ' Esto solo para AutoCAD 2008 o superior ' Si el valor es texto de mutiples lineas If acAttDef.IsMTextAttributeDefinition Then acAttRef.UpdateMTextAttribute() End If acAttRef.TextString = acAttDef.TextString ' Agregar la referencia de atributo a la ' referencia a bloque y a la transaccion acBlkRef.AttributeCollection.AppendAttribute(acAttRef) acTrans.AddNewlyCreatedDBObject(acAttRef, True) End If End If Next End If ' Confirmar los cambios acTrans.Commit() End If End Using End Sub