<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to implement Explode Command in Python in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-implement-explode-command-in-python/m-p/10823011#M51244</link>
    <description>&lt;P&gt;Does anyone know how to program in python the explode command to be applied to a dynamic block and then get its attributes?&lt;/P&gt;</description>
    <pubDate>Tue, 14 Dec 2021 19:45:45 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2021-12-14T19:45:45Z</dc:date>
    <item>
      <title>How to implement Explode Command in Python</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-implement-explode-command-in-python/m-p/10823011#M51244</link>
      <description>&lt;P&gt;Does anyone know how to program in python the explode command to be applied to a dynamic block and then get its attributes?&lt;/P&gt;</description>
      <pubDate>Tue, 14 Dec 2021 19:45:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-implement-explode-command-in-python/m-p/10823011#M51244</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-12-14T19:45:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to implement Explode Command in Python</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-implement-explode-command-in-python/m-p/10859080#M51245</link>
      <description>&lt;P&gt;why you need python for this simple AutoCAD thing.&lt;/P&gt;&lt;P&gt;you can use lee mac Burts upgraded Command.&lt;/P&gt;&lt;P&gt;Check the Below link :&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.lee-mac.com/upgradedburst.html" target="_blank" rel="noopener"&gt;http://www.lee-mac.com/upgradedburst.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Hope this will help you.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jan 2022 09:43:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-implement-explode-command-in-python/m-p/10859080#M51245</guid>
      <dc:creator>fkp7057</dc:creator>
      <dc:date>2022-01-05T09:43:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to implement Explode Command in Python</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-implement-explode-command-in-python/m-p/10859140#M51246</link>
      <description>&lt;P&gt;HI&lt;/P&gt;&lt;P&gt;BY dynamo Python Script&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://forum.dynamobim.com/t/access-attributes-in-blocks/38147/3?u=hosneyalaa" target="_blank"&gt;https://forum.dynamobim.com/t/access-attributes-in-blocks/38147/3?u=hosneyalaa&lt;/A&gt;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;"""
Copyright 2019 Autodesk, Inc. All rights reserved.

This file is part of the Civil 3D Python Module.

"""
__author__ = 'Paolo Emilio Serra - paolo.serra@autodesk.com'
__copyright__ = '2019'
__version__ = '1.0.0'

import clr

# Add Assemblies for AutoCAD and Civil 3D APIs
clr.AddReference('acmgd')
clr.AddReference('acdbmgd')
clr.AddReference('accoremgd')
clr.AddReference('AecBaseMgd')
clr.AddReference('AecPropDataMgd')
clr.AddReference('AeccDbMgd')
clr.AddReference('AeccPressurePipesMgd')
clr.AddReference('acdbmgdbrep')
clr.AddReference('System.Windows.Forms')
clr.AddReference('AutoCADNodes')

# Add standard Python references
import sys
sys.path.append('C:\Program Files (x86)\IronPython 2.7\Lib')
import os
import math

# Add references to manage arrays, collections and interact with the user
from System import *
from System.IO import *
from System.Collections.Specialized import *
from System.Windows.Forms import MessageBox

# Create an alias to the Autodesk.AutoCAD.ApplicationServices.Application class
import Autodesk.AutoCAD.ApplicationServices.Application as acapp

# Import references from AutoCAD
from Autodesk.AutoCAD.Runtime import *
from Autodesk.AutoCAD.ApplicationServices import *
from Autodesk.AutoCAD.EditorInput import *
from Autodesk.AutoCAD.DatabaseServices import *
from Autodesk.AutoCAD.Geometry import *

# Import references for PropertySets
from Autodesk.Aec.PropertyData import *
from Autodesk.Aec.PropertyData.DatabaseServices import *

# Import references for Civil 3D
from Autodesk.Civil.ApplicationServices import *
from Autodesk.Civil.DatabaseServices import *

# Import Dynamo for AutoCAD nodes
from Autodesk.AutoCAD.DynamoNodes import *

adoc = acapp.DocumentManager.MdiActiveDocument
ed = adoc.Editor

# Example function
def get_block_references_tag(input):
	"""
	Description....
	:param first_param: ....
	:returns: ....
	"""
	if not isinstance(input, BlockReference):
		return
	
	input = input.InternalDBObject
	
	if len(input.AttributeCollection) == 0:
		return []
		
	global adoc
	
	output = {}

	with adoc.LockDocument():
		with adoc.Database as db:
			with db.TransactionManager.StartTransaction() as t:
				bt = t.GetObject(db.BlockTableId, OpenMode.ForWrite)
				btr = t.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite)
				
				for oid in input.AttributeCollection:
					att = t.GetObject(oid, OpenMode.ForWrite)
					output[att.Tag] = att.TextString

				t.Commit()
	return output
	
	
OUT = get_block_references_tag(IN[0])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1007602i8E25D7A65CCBAA0D/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jan 2022 10:25:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-implement-explode-command-in-python/m-p/10859140#M51246</guid>
      <dc:creator>hosneyalaa</dc:creator>
      <dc:date>2022-01-05T10:25:18Z</dc:date>
    </item>
  </channel>
</rss>

