<?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 Re: Export without auto shape name in ArcGIS CityEngine Questions</title>
    <link>https://community.esri.com/t5/arcgis-cityengine-questions/export-without-auto-shape-name/m-p/691895#M9116</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey, I'm also interested in these kind of naming tweaks...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think the suffix CE uses is the shape name.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So, my first thought:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- name each shape (with help of a python script and ce.setName()) after the desired attribute and, during export, just give an empty String on settings.setGeneralName(""). However, it seems CE does not allow generalName to be empty (at least the GUI doesn't seem to)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'd love to know how to do accomplish this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hi Matt,&lt;BR /&gt;&lt;BR /&gt;My desired naming convention per model will be similar to:&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;CitI0005.dae&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;This model name is taken from the shape's object attributes and exported per-inital shape using the following script:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

from scripting import *

ce = CE()

def export(object, modelName):
&amp;nbsp;&amp;nbsp;&amp;nbsp; dir = ce.toFSPath("models/")
&amp;nbsp;&amp;nbsp;&amp;nbsp; settings = DAEExportModelSettings()
&amp;nbsp;&amp;nbsp;&amp;nbsp; settings.setGeneralLocation(dir)
&amp;nbsp;&amp;nbsp;&amp;nbsp; settings.setGeneralName(modelName)
&amp;nbsp;&amp;nbsp;&amp;nbsp; settings.setGranularityFile(DAEExportModelSettings.PER_INITIAL_SHAPE)
&amp;nbsp;&amp;nbsp;&amp;nbsp; settings.setMiscOptionsWriteExportLog(False)
&amp;nbsp;&amp;nbsp;&amp;nbsp; ce.export(object, settings)

if __name__ == '__main__':
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; print ("__DAE Export Loop Started__")
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; shapes = ce.getObjectsFrom(ce.selection, ce.isShape)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; IDshape = 0
&amp;nbsp;&amp;nbsp;&amp;nbsp; for shape in shapes :
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name = ce.getAttribute(shape, 'MODEL')
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string = name.rstrip('3ds')
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; modelName = string.strip('.')
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; export(shape, modelName)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print(modelName)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; IDshape += 1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; pass

print ("__All Selected Models Exported__")

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;This exports each model with a name such as:&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;CitI0005_shape99.dae&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;To strip the shape name from each file I just run the following script externally:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

# Modules
import os, shutil

# Root folder for files
daeRoot = r'C:\Users\******\Desktop\Sort'

def renameFiles(target):
 os.chdir(target)
 for filename in os.listdir('.'):
&amp;nbsp; print filename
&amp;nbsp; fullname = os.path.splitext(filename)[0]
&amp;nbsp; ext = os.path.splitext(filename)[1]
&amp;nbsp; prefix = fullname [:8]
&amp;nbsp; newfilename = prefix + ext
&amp;nbsp; print newfilename
&amp;nbsp; os.rename(filename, newfilename)
&amp;nbsp; print "Renamed " + filename + " to " + newfilename
 
if (__name__ == '__main__'):
 renameFiles(daeRoot)

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;I was just wondering if there was a way to export without the shape name so I don't have to run this extra script to strip the characters? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 05:07:15 GMT</pubDate>
    <dc:creator>AndréCardoso</dc:creator>
    <dc:date>2021-12-12T05:07:15Z</dc:date>
    <item>
      <title>Export without auto shape name</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/export-without-auto-shape-name/m-p/691892#M9113</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Just a quick question:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there any way to export models without the Shape Name being added automatically? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a python script to batch name and export each file individually based on an object attribute. Because the shape name is added automatically I am needing to go in subsequently and strip the Shape Name off the file to adhere to our naming convention.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dan.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2012 22:12:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/export-without-auto-shape-name/m-p/691892#M9113</guid>
      <dc:creator>DanSmith3</dc:creator>
      <dc:date>2012-02-22T22:12:16Z</dc:date>
    </item>
    <item>
      <title>Re: Export without auto shape name</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/export-without-auto-shape-name/m-p/691893#M9114</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;hmm. can you post a few naming examples ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;so you are defining the file name via the exporter settings in Python, correct ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;matt&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Feb 2012 07:31:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/export-without-auto-shape-name/m-p/691893#M9114</guid>
      <dc:creator>MatthiasBuehler1</dc:creator>
      <dc:date>2012-02-23T07:31:49Z</dc:date>
    </item>
    <item>
      <title>Re: Export without auto shape name</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/export-without-auto-shape-name/m-p/691894#M9115</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Matt,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My desired naming convention per model will be similar to:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;CitI0005.dae&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This model name is taken from the shape's object attributes and exported per-inital shape using the following script:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

from scripting import *

ce = CE()

def export(object, modelName):
&amp;nbsp;&amp;nbsp;&amp;nbsp; dir = ce.toFSPath("models/")
&amp;nbsp;&amp;nbsp;&amp;nbsp; settings = DAEExportModelSettings()
&amp;nbsp;&amp;nbsp;&amp;nbsp; settings.setGeneralLocation(dir)
&amp;nbsp;&amp;nbsp;&amp;nbsp; settings.setGeneralName(modelName)
&amp;nbsp;&amp;nbsp;&amp;nbsp; settings.setGranularityFile(DAEExportModelSettings.PER_INITIAL_SHAPE)
&amp;nbsp;&amp;nbsp;&amp;nbsp; settings.setMiscOptionsWriteExportLog(False)
&amp;nbsp;&amp;nbsp;&amp;nbsp; ce.export(object, settings)

if __name__ == '__main__':
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; print ("__DAE Export Loop Started__")
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; shapes = ce.getObjectsFrom(ce.selection, ce.isShape)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; IDshape = 0
&amp;nbsp;&amp;nbsp;&amp;nbsp; for shape in shapes :
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name = ce.getAttribute(shape, 'MODEL')
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string = name.rstrip('3ds')
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; modelName = string.strip('.')
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; export(shape, modelName)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print(modelName)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; IDshape += 1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; pass

print ("__All Selected Models Exported__")

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This exports each model with a name such as:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;CitI0005_shape99.dae&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To strip the shape name from each file I just run the following script externally:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

# Modules
import os, shutil

# Root folder for files
daeRoot = r'C:\Users\******\Desktop\Sort'

def renameFiles(target):
 os.chdir(target)
 for filename in os.listdir('.'):
&amp;nbsp; print filename
&amp;nbsp; fullname = os.path.splitext(filename)[0]
&amp;nbsp; ext = os.path.splitext(filename)[1]
&amp;nbsp; prefix = fullname [:8]
&amp;nbsp; newfilename = prefix + ext
&amp;nbsp; print newfilename
&amp;nbsp; os.rename(filename, newfilename)
&amp;nbsp; print "Renamed " + filename + " to " + newfilename
 
if (__name__ == '__main__'):
 renameFiles(daeRoot)

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I was just wondering if there was a way to export without the shape name so I don't have to run this extra script to strip the characters? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:07:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/export-without-auto-shape-name/m-p/691894#M9115</guid>
      <dc:creator>DanSmith3</dc:creator>
      <dc:date>2021-12-12T05:07:13Z</dc:date>
    </item>
    <item>
      <title>Re: Export without auto shape name</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/export-without-auto-shape-name/m-p/691895#M9116</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey, I'm also interested in these kind of naming tweaks...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think the suffix CE uses is the shape name.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So, my first thought:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- name each shape (with help of a python script and ce.setName()) after the desired attribute and, during export, just give an empty String on settings.setGeneralName(""). However, it seems CE does not allow generalName to be empty (at least the GUI doesn't seem to)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'd love to know how to do accomplish this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hi Matt,&lt;BR /&gt;&lt;BR /&gt;My desired naming convention per model will be similar to:&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;CitI0005.dae&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;This model name is taken from the shape's object attributes and exported per-inital shape using the following script:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

from scripting import *

ce = CE()

def export(object, modelName):
&amp;nbsp;&amp;nbsp;&amp;nbsp; dir = ce.toFSPath("models/")
&amp;nbsp;&amp;nbsp;&amp;nbsp; settings = DAEExportModelSettings()
&amp;nbsp;&amp;nbsp;&amp;nbsp; settings.setGeneralLocation(dir)
&amp;nbsp;&amp;nbsp;&amp;nbsp; settings.setGeneralName(modelName)
&amp;nbsp;&amp;nbsp;&amp;nbsp; settings.setGranularityFile(DAEExportModelSettings.PER_INITIAL_SHAPE)
&amp;nbsp;&amp;nbsp;&amp;nbsp; settings.setMiscOptionsWriteExportLog(False)
&amp;nbsp;&amp;nbsp;&amp;nbsp; ce.export(object, settings)

if __name__ == '__main__':
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; print ("__DAE Export Loop Started__")
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; shapes = ce.getObjectsFrom(ce.selection, ce.isShape)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; IDshape = 0
&amp;nbsp;&amp;nbsp;&amp;nbsp; for shape in shapes :
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name = ce.getAttribute(shape, 'MODEL')
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string = name.rstrip('3ds')
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; modelName = string.strip('.')
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; export(shape, modelName)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print(modelName)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; IDshape += 1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; pass

print ("__All Selected Models Exported__")

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;This exports each model with a name such as:&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;CitI0005_shape99.dae&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;To strip the shape name from each file I just run the following script externally:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

# Modules
import os, shutil

# Root folder for files
daeRoot = r'C:\Users\******\Desktop\Sort'

def renameFiles(target):
 os.chdir(target)
 for filename in os.listdir('.'):
&amp;nbsp; print filename
&amp;nbsp; fullname = os.path.splitext(filename)[0]
&amp;nbsp; ext = os.path.splitext(filename)[1]
&amp;nbsp; prefix = fullname [:8]
&amp;nbsp; newfilename = prefix + ext
&amp;nbsp; print newfilename
&amp;nbsp; os.rename(filename, newfilename)
&amp;nbsp; print "Renamed " + filename + " to " + newfilename
 
if (__name__ == '__main__'):
 renameFiles(daeRoot)

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;I was just wondering if there was a way to export without the shape name so I don't have to run this extra script to strip the characters? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:07:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/export-without-auto-shape-name/m-p/691895#M9116</guid>
      <dc:creator>AndréCardoso</dc:creator>
      <dc:date>2021-12-12T05:07:15Z</dc:date>
    </item>
    <item>
      <title>Re: Export without auto shape name</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/export-without-auto-shape-name/m-p/691896#M9117</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;hi !&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I just heard this behavior is hardcoded, thus you'll NEED to rename the file as you're currently doing...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Feb 2012 16:33:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/export-without-auto-shape-name/m-p/691896#M9117</guid>
      <dc:creator>MatthiasBuehler1</dc:creator>
      <dc:date>2012-02-28T16:33:44Z</dc:date>
    </item>
  </channel>
</rss>

