{"id":27,"date":"2014-10-05T17:09:33","date_gmt":"2014-10-05T16:09:33","guid":{"rendered":"http:\/\/pythoncvc.net\/?p=27"},"modified":"2014-11-06T22:57:48","modified_gmt":"2014-11-06T21:57:48","slug":"renommer-automatiquement-les-vues-de-maniere-plus-intelligente-3","status":"publish","type":"post","link":"https:\/\/pythoncvc.net\/?p=27","title":{"rendered":"[Revit] Renommer automatiquement les vues de mani\u00e8re plus intelligente"},"content":{"rendered":"<p>Quand vous devez cr\u00e9er plusieurs vues d&rsquo;un m\u00eame niveau (ventilation, chauffage de sol, \u00e9lectricit\u00e9 etc&#8230;), Revit a la brillante id\u00e9e de rajouter\u00a0 (1), (2) etc&#8230;<\/p>\n<p><a href=\"https:\/\/pythoncvc.net\/wp-content\/uploads\/2014\/10\/revitnommevue.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-3\" src=\"https:\/\/pythoncvc.net\/wp-content\/uploads\/2014\/10\/revitnommevue.png?w=224\" alt=\"revitnommevue\" width=\"224\" height=\"300\" \/><\/a><a href=\"https:\/\/pythoncvc.net\/wp-content\/uploads\/2014\/10\/pythonnommevue.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-21\" src=\"https:\/\/pythoncvc.net\/wp-content\/uploads\/2014\/10\/pythonnommevue.png?w=278\" alt=\"pythonnommevue\" width=\"278\" height=\"300\" srcset=\"https:\/\/pythoncvc.net\/wp-content\/uploads\/2014\/10\/pythonnommevue.png 293w, https:\/\/pythoncvc.net\/wp-content\/uploads\/2014\/10\/pythonnommevue-278x300.png 278w\" sizes=\"auto, (max-width: 278px) 100vw, 278px\" \/><\/a><\/p>\n<p>Voici un petit script pour renommer automatiquement les vues en ajoutant le nom du type de plan :<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">uidoc = __revit__.ActiveUIDocument\r\ndoc = __revit__.ActiveUIDocument.Document\r\ngetselection = uidoc.Selection.GetElementIds\r\n\r\nt = Transaction(doc, \"Renomme la vue\")\r\nt.Start()\r\nfor e in getselection(): #Cherche l'Id des \u00e9l\u00e9ments s\u00e9lectionn\u00e9s\r\n\u00a0\u00a0 \u00a0view = doc.GetElement(e) #Cherche l'\u00e9l\u00e9ment correspondant \u00e0 l'Id\r\n\u00a0\u00a0 \u00a0vft = doc.GetElement(view.GetTypeId()) #Get ViewFamilyType Id\r\n\u00a0\u00a0 \u00a0vft_name = Element.Name.GetValue(vft) #Get ViewFamilyType Name\r\n\u00a0\u00a0 \u00a0view.Name = view.GenLevel.Name + \" - \" + vft_name #Nomme la vue avec nom du niveau associ\u00e9 + nom du type de la vue\r\nt.Commit()<\/pre>\n<p>Vous pouvez facilement modifier le code pour mettre un suffixe, un pr\u00e9fixe ou prendre un autre nom de param\u00e8tre existant .<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Quand vous devez cr\u00e9er plusieurs vues d&rsquo;un m\u00eame niveau (ventilation, chauffage de sol, \u00e9lectricit\u00e9 etc&#8230;), Revit a la brillante id\u00e9e de rajouter\u00a0 (1), (2) etc&#8230; Voici un petit script pour renommer automatiquement les vues en ajoutant le nom du type de plan : uidoc = __revit__.ActiveUIDocument doc = __revit__.ActiveUIDocument.Document getselection = uidoc.Selection.GetElementIds t = Transaction(doc, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","footnotes":""},"categories":[3],"tags":[10,22,28,4],"class_list":["post-27","post","type-post","status-publish","format-standard","hentry","category-script","tag-gestion","tag-revit-api-2015-fr","tag-revitpythonshell-fr","tag-vues"],"_links":{"self":[{"href":"https:\/\/pythoncvc.net\/index.php?rest_route=\/wp\/v2\/posts\/27","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pythoncvc.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pythoncvc.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pythoncvc.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pythoncvc.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=27"}],"version-history":[{"count":4,"href":"https:\/\/pythoncvc.net\/index.php?rest_route=\/wp\/v2\/posts\/27\/revisions"}],"predecessor-version":[{"id":61,"href":"https:\/\/pythoncvc.net\/index.php?rest_route=\/wp\/v2\/posts\/27\/revisions\/61"}],"wp:attachment":[{"href":"https:\/\/pythoncvc.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=27"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pythoncvc.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=27"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pythoncvc.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=27"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}