Diff
checker
Text
Text
Bilder
Dokumente
Excel
Ordner
Legal
Enterprise
Desktop-App
Preise
Einloggen
Diffchecker Desktop herunterladen
Texte vergleichen
Finde den Unterschied zwischen zwei Textdateien
Werkzeuge
Verlauf
Live-Editor
Gleiches ausblenden
Zeilenumbruch aus
Ansicht
Zweispaltig
Einspaltig
Vergleichsgenauigkeit
Intelligent
Wort
Zeichen
Syntaxhervorhebung
Syntax auswählen
Ignorieren
Text umwandeln
Zur ersten Änderung
Eingabe bearbeiten
Diffchecker Desktop
Der sicherste Weg, Diffchecker zu nutzen. Hol dir die Desktop-App: Deine Diffs verlassen nie deinen Computer!
Desktop holen
ScriptDiff
Erstellt
vor 2 Jahren
Diff läuft nie ab
Löschen
Exportieren
Teilen
Erklären
13 Entfernungen
Zeilen
Gesamt
Entfernt
Zeichen
Gesamt
Entfernt
Um diese Funktion weiterhin zu nutzen, aktualisiere auf
Diff
checker
Pro
Preise anzeigen
130 Zeilen
Kopieren
35 Hinzufügungen
Zeilen
Gesamt
Hinzugefügt
Zeichen
Gesamt
Hinzugefügt
Um diese Funktion weiterhin zu nutzen, aktualisiere auf
Diff
checker
Pro
Preise anzeigen
133 Zeilen
Kopieren
import Rhino
import Rhino
import rhinoscriptsyntax as rs
import rhinoscriptsyntax as rs
import scriptcontext as sc
import scriptcontext as sc
import re
import re
import os
import os
Kopieren
Kopiert
Kopieren
Kopiert
import os.path as op
from fractions import Fraction
from fractions import Fraction
_nsre = re.compile('([0-9]+)')
_nsre = re.compile('([0-9]+)')
def natural_sort_key(s):
def natural_sort_key(s):
return [int(text) if text.isdigit() else text.lower()
return [int(text) if text.isdigit() else text.lower()
for text in re.split(_nsre, s)]
for text in re.split(_nsre, s)]
def test():
def test():
categories = {}
categories = {}
max = 0
max = 0
ids = rs.AllObjects()
ids = rs.AllObjects()
Kopieren
Kopiert
Kopieren
Kopiert
for
id in ids:
for
obj_
id in ids:
if rs.IsText(
id):
if rs.IsText(
obj_
id):
text = rs.TextObjectText(
id)
text = rs.TextObjectText(
obj_
id)
idx = text.find("-")
idx = text.find("-")
if idx != -1:
if idx != -1:
name = text[:idx-1]
name = text[:idx-1]
Kopieren
Kopiert
Kopieren
Kopiert
rs.ObjectName(
id, name)
rs.ObjectName(
obj_
id, name)
cat = rs.GetUserText(
id, 'Cat')
cat = rs.GetUserText(
obj_
id, 'Cat')
subcat = rs.GetUserText(
id, 'SubCat')
subcat = rs.GetUserText(
obj_
id, 'SubCat')
max = max + 1
max = max + 1
if not cat:
if not cat:
rs.MessageBox(text + ' does not have a Cat tag.')
rs.MessageBox(text + ' does not have a Cat tag.')
if not subcat:
if not subcat:
subcat = '---'
subcat = '---'
if cat:
if cat:
Kopieren
Kopiert
Kopieren
Kopiert
if
not
categories
.has_key(cat)
:
if
cat
not
in
categories
:
categories[cat] = {}
categories[cat] = {}
Kopieren
Kopiert
Kopieren
Kopiert
if
not
categories[cat]
.has_key(subcat)
:
if
subcat
not
in
categories[cat]
:
categories[cat][subcat] = [
id]
categories[cat][subcat] = [
obj_
id]
else:
else:
Kopieren
Kopiert
Kopieren
Kopiert
categories[cat][subcat].append(
id)
categories[cat][subcat].append(
obj_
id)
Rhino.UI.StatusBar.ShowProgressMeter(sc.doc.RuntimeSerialNumber, 0, max, "Processing", True, True)
Rhino.UI.StatusBar.ShowProgressMeter(sc.doc.RuntimeSerialNumber, 0, max, "Processing", True, True)
count = 0
count = 0
csv_txt = 'Category,Subcategory,Order,Filename,Profile Name,Height,Width\n';
csv_txt = 'Category,Subcategory,Order,Filename,Profile Name,Height,Width\n';
Kopieren
Kopiert
Kopieren
Kopiert
rs.EnableRedraw(
True)
rs.EnableRedraw(
False)
export_root =
rs.WorkingFolder() + "/
exports"
export_dir = op.dirname(__file__)
export_root =
op.join(export_dir, "
exports"
)
if not op.exists(export_root):
os.makedirs(export_root)
# loop over each category
# loop over each category
for cat in categories:
for cat in categories:
for subcat in categories[cat]:
for subcat in categories[cat]:
ids = categories[cat][subcat]
ids = categories[cat][subcat]
if not ids: return
if not ids: return
dict = {}
dict = {}
distances = []
distances = []
Kopieren
Kopiert
Kopieren
Kopiert
names = set([rs.ObjectName(
id) for
id in ids])
names = set([rs.ObjectName(
obj_
id) for
obj_
id in ids])
for name in names:
for name in names:
# parse the text object text to get the long dimension then sort by that number
# parse the text object text to get the long dimension then sort by that number
ids = rs.ObjectsByName(name)
ids = rs.ObjectsByName(name)
if not ids: continue
if not ids: continue
if len(ids) != 2: continue
if len(ids) != 2: continue
bb = rs.BoundingBox(ids)
bb = rs.BoundingBox(ids)
Kopieren
Kopiert
Kopieren
Kopiert
for
id in ids:
for
obj_
id in ids:
if rs.IsText(
id):
if rs.IsText(
obj_
id):
text = rs.TextObjectText(
id).splitlines()[0]
text = rs.TextObjectText(
obj_
id).splitlines()[0]
# get the last element in the split array, don't read the last character either
# get the last element in the split array, don't read the last character either
widthText = text.split("x ")[-1][:-1]
widthText = text.split("x ")[-1][:-1]
dist = float(sum(Fraction(s) for s in widthText.split()))
dist = float(sum(Fraction(s) for s in widthText.split()))
if dict.has_key(dist):
if dict.has_key(dist):
temp = dict[dist]
temp = dict[dist]
temp = temp + "," + name
temp = temp + "," + name
else:
else:
temp = name
temp = name
dict[dist] = temp
dict[dist] = temp
partList = sorted(dict.keys())
partList = sorted(dict.keys())
# for now, we just prompt the user for a category and subcategory name, later we can put these in the attributes on each text object instead
# for now, we just prompt the user for a category and subcategory name, later we can put these in the attributes on each text object instead
export_folder = export_root
export_folder = export_root
units = rs.UnitSystemName()
units = rs.UnitSystemName()
for item in partList:
for item in partList:
test = dict[item]
test = dict[item]
names = dict[item].split(",")
names = dict[item].split(",")
names.sort(key=natural_sort_key)
names.sort(key=natural_sort_key)
for name in names:
for name in names:
ids = rs.ObjectsByName(name)
ids = rs.ObjectsByName(name)
fileName = str(count) + "_" + name + ".ai"
fileName = str(count) + "_" + name + ".ai"
if not ids: continue
if not ids: continue
if len(ids) != 2: continue
if len(ids) != 2: continue
bb = rs.BoundingBox(ids)
bb = rs.BoundingBox(ids)
vecDir = Rhino.Geometry.Point3d(0,0,0) - bb[0]
vecDir = Rhino.Geometry.Point3d(0,0,0) - bb[0]
rs.MoveObjects(ids, vecDir)
rs.MoveObjects(ids, vecDir)
rs.UnselectAllObjects()
rs.UnselectAllObjects()
rs.SelectObjects(ids)
rs.SelectObjects(ids)
if not os.path.exists(export_folder):
if not os.path.exists(export_folder):
os.makedirs(export_folder)
os.makedirs(export_folder)
rs.Command("-Export " + chr(34) + export_folder + "/" + fileName + chr(34) + " PreserveUnits=Yes AIScale=1 Unit=" + units + " RhinoScale=1 Enter")
rs.Command("-Export " + chr(34) + export_folder + "/" + fileName + chr(34) + " PreserveUnits=Yes AIScale=1 Unit=" + units + " RhinoScale=1 Enter")
vecDir.Reverse()
vecDir.Reverse()
rs.MoveObjects(ids, vecDir)
rs.MoveObjects(ids, vecDir)
count = count + 1
count = count + 1
w = h = 0
w = h = 0
# we need to check the 2 objects to find out which is the text label
# we need to check the 2 objects to find out which is the text label
Kopieren
Kopiert
Kopieren
Kopiert
for
id in ids:
for
obj_
id in ids:
if rs.IsText(
id):
if rs.IsText(
obj_
id):
# we found the text so let's break out the width and height values
# we found the text so let's break out the width and height values
Kopieren
Kopiert
Kopieren
Kopiert
text = rs.TextObjectText(
id)
text = rs.TextObjectText(
obj_
id)
idx = text.find(" - ")
idx = text.find(" - ")
if idx != -1:
if idx != -1:
dimension_str = text[idx+3:]
dimension_str = text[idx+3:]
w = dimension_str.split(" x ")[1][:-1]
w = dimension_str.split(" x ")[1][:-1]
h = dimension_str.split(" x ")[0][:-1]
h = dimension_str.split(" x ")[0][:-1]
csv_txt += cat + ',' + subcat + ',' + str(count) + ',"' + fileName + '","' + name + '",' + str(h) + ',' + str(w) + '\n'
csv_txt += cat + ',' + subcat + ',' + str(count) + ',"' + fileName + '","' + name + '",' + str(h) + ',' + str(w) + '\n'
Rhino.UI.StatusBar.UpdateProgressMeter("Processing", count, True)
Rhino.UI.StatusBar.UpdateProgressMeter("Processing", count, True)
Kopieren
Kopiert
Kopieren
Kopiert
#
Rhino.UI.StatusBar.UpdateProgressMeter(count, True)
Rhino.UI.StatusBar.UpdateProgressMeter(count, True)
rs.EnableRedraw(True)
rs.EnableRedraw(True)
Rhino.UI.StatusBar.HideProgressMeter(sc.doc.RuntimeSerialNumber)
Rhino.UI.StatusBar.HideProgressMeter(sc.doc.RuntimeSerialNumber)
# write out the CSV string to the target CSV file
# write out the CSV string to the target CSV file
Kopieren
Kopiert
Kopieren
Kopiert
file =
open(
export_root
+ "/
indesign_data.csv"
, "w")
with
open(
op.join(
export_root
, "
indesign_data.csv"
)
, "w")
as f:
file
.write(csv_txt)
f
.write(csv_txt)
file.close()
if __name__ == "__main__":
if __name__ == "__main__":
test()
test()
Gespeicherte Diffs
Originaltext
Datei öffnen
import Rhino import rhinoscriptsyntax as rs import scriptcontext as sc import re import os from fractions import Fraction _nsre = re.compile('([0-9]+)') def natural_sort_key(s): return [int(text) if text.isdigit() else text.lower() for text in re.split(_nsre, s)] def test(): categories = {} max = 0 ids = rs.AllObjects() for id in ids: if rs.IsText(id): text = rs.TextObjectText(id) idx = text.find("-") if idx != -1: name = text[:idx-1] rs.ObjectName(id, name) cat = rs.GetUserText(id, 'Cat') subcat = rs.GetUserText(id, 'SubCat') max = max + 1 if not cat: rs.MessageBox(text + ' does not have a Cat tag.') if not subcat: subcat = '---' if cat: if not categories.has_key(cat): categories[cat] = {} if not categories[cat].has_key(subcat): categories[cat][subcat] = [id] else: categories[cat][subcat].append(id) Rhino.UI.StatusBar.ShowProgressMeter(sc.doc.RuntimeSerialNumber, 0, max, "Processing", True, True) count = 0 csv_txt = 'Category,Subcategory,Order,Filename,Profile Name,Height,Width\n'; rs.EnableRedraw(True) export_root = rs.WorkingFolder() + "/exports" # loop over each category for cat in categories: for subcat in categories[cat]: ids = categories[cat][subcat] if not ids: return dict = {} distances = [] names = set([rs.ObjectName(id) for id in ids]) for name in names: # parse the text object text to get the long dimension then sort by that number ids = rs.ObjectsByName(name) if not ids: continue if len(ids) != 2: continue bb = rs.BoundingBox(ids) for id in ids: if rs.IsText(id): text = rs.TextObjectText(id).splitlines()[0] # get the last element in the split array, don't read the last character either widthText = text.split("x ")[-1][:-1] dist = float(sum(Fraction(s) for s in widthText.split())) if dict.has_key(dist): temp = dict[dist] temp = temp + "," + name else: temp = name dict[dist] = temp partList = sorted(dict.keys()) # for now, we just prompt the user for a category and subcategory name, later we can put these in the attributes on each text object instead export_folder = export_root units = rs.UnitSystemName() for item in partList: test = dict[item] names = dict[item].split(",") names.sort(key=natural_sort_key) for name in names: ids = rs.ObjectsByName(name) fileName = str(count) + "_" + name + ".ai" if not ids: continue if len(ids) != 2: continue bb = rs.BoundingBox(ids) vecDir = Rhino.Geometry.Point3d(0,0,0) - bb[0] rs.MoveObjects(ids, vecDir) rs.UnselectAllObjects() rs.SelectObjects(ids) if not os.path.exists(export_folder): os.makedirs(export_folder) rs.Command("-Export " + chr(34) + export_folder + "/" + fileName + chr(34) + " PreserveUnits=Yes AIScale=1 Unit=" + units + " RhinoScale=1 Enter") vecDir.Reverse() rs.MoveObjects(ids, vecDir) count = count + 1 w = h = 0 # we need to check the 2 objects to find out which is the text label for id in ids: if rs.IsText(id): # we found the text so let's break out the width and height values text = rs.TextObjectText(id) idx = text.find(" - ") if idx != -1: dimension_str = text[idx+3:] w = dimension_str.split(" x ")[1][:-1] h = dimension_str.split(" x ")[0][:-1] csv_txt += cat + ',' + subcat + ',' + str(count) + ',"' + fileName + '","' + name + '",' + str(h) + ',' + str(w) + '\n' Rhino.UI.StatusBar.UpdateProgressMeter("Processing", count, True) # Rhino.UI.StatusBar.UpdateProgressMeter(count, True) rs.EnableRedraw(True) Rhino.UI.StatusBar.HideProgressMeter(sc.doc.RuntimeSerialNumber) # write out the CSV string to the target CSV file file = open(export_root + "/indesign_data.csv", "w") file.write(csv_txt) file.close() if __name__ == "__main__": test()
Bearbeitung
Datei öffnen
import Rhino import rhinoscriptsyntax as rs import scriptcontext as sc import re import os import os.path as op from fractions import Fraction _nsre = re.compile('([0-9]+)') def natural_sort_key(s): return [int(text) if text.isdigit() else text.lower() for text in re.split(_nsre, s)] def test(): categories = {} max = 0 ids = rs.AllObjects() for obj_id in ids: if rs.IsText(obj_id): text = rs.TextObjectText(obj_id) idx = text.find("-") if idx != -1: name = text[:idx-1] rs.ObjectName(obj_id, name) cat = rs.GetUserText(obj_id, 'Cat') subcat = rs.GetUserText(obj_id, 'SubCat') max = max + 1 if not cat: rs.MessageBox(text + ' does not have a Cat tag.') if not subcat: subcat = '---' if cat: if cat not in categories: categories[cat] = {} if subcat not in categories[cat]: categories[cat][subcat] = [obj_id] else: categories[cat][subcat].append(obj_id) Rhino.UI.StatusBar.ShowProgressMeter(sc.doc.RuntimeSerialNumber, 0, max, "Processing", True, True) count = 0 csv_txt = 'Category,Subcategory,Order,Filename,Profile Name,Height,Width\n'; rs.EnableRedraw(False) export_dir = op.dirname(__file__) export_root = op.join(export_dir, "exports") if not op.exists(export_root): os.makedirs(export_root) # loop over each category for cat in categories: for subcat in categories[cat]: ids = categories[cat][subcat] if not ids: return dict = {} distances = [] names = set([rs.ObjectName(obj_id) for obj_id in ids]) for name in names: # parse the text object text to get the long dimension then sort by that number ids = rs.ObjectsByName(name) if not ids: continue if len(ids) != 2: continue bb = rs.BoundingBox(ids) for obj_id in ids: if rs.IsText(obj_id): text = rs.TextObjectText(obj_id).splitlines()[0] # get the last element in the split array, don't read the last character either widthText = text.split("x ")[-1][:-1] dist = float(sum(Fraction(s) for s in widthText.split())) if dict.has_key(dist): temp = dict[dist] temp = temp + "," + name else: temp = name dict[dist] = temp partList = sorted(dict.keys()) # for now, we just prompt the user for a category and subcategory name, later we can put these in the attributes on each text object instead export_folder = export_root units = rs.UnitSystemName() for item in partList: test = dict[item] names = dict[item].split(",") names.sort(key=natural_sort_key) for name in names: ids = rs.ObjectsByName(name) fileName = str(count) + "_" + name + ".ai" if not ids: continue if len(ids) != 2: continue bb = rs.BoundingBox(ids) vecDir = Rhino.Geometry.Point3d(0,0,0) - bb[0] rs.MoveObjects(ids, vecDir) rs.UnselectAllObjects() rs.SelectObjects(ids) if not os.path.exists(export_folder): os.makedirs(export_folder) rs.Command("-Export " + chr(34) + export_folder + "/" + fileName + chr(34) + " PreserveUnits=Yes AIScale=1 Unit=" + units + " RhinoScale=1 Enter") vecDir.Reverse() rs.MoveObjects(ids, vecDir) count = count + 1 w = h = 0 # we need to check the 2 objects to find out which is the text label for obj_id in ids: if rs.IsText(obj_id): # we found the text so let's break out the width and height values text = rs.TextObjectText(obj_id) idx = text.find(" - ") if idx != -1: dimension_str = text[idx+3:] w = dimension_str.split(" x ")[1][:-1] h = dimension_str.split(" x ")[0][:-1] csv_txt += cat + ',' + subcat + ',' + str(count) + ',"' + fileName + '","' + name + '",' + str(h) + ',' + str(w) + '\n' Rhino.UI.StatusBar.UpdateProgressMeter("Processing", count, True) Rhino.UI.StatusBar.UpdateProgressMeter(count, True) rs.EnableRedraw(True) Rhino.UI.StatusBar.HideProgressMeter(sc.doc.RuntimeSerialNumber) # write out the CSV string to the target CSV file with open(op.join(export_root, "indesign_data.csv"), "w") as f: f.write(csv_txt) if __name__ == "__main__": test()
Unterschied finden