Wow it works for you!!!
I guess I have a problem with the Import DWG.dyf
Or with the Python code in it??
#Based on a Konrad Sobon script
#Additions by Alban de Chasteigner 2018
#Suggestion of Ryan Lenihan
import clr
Import DocumentManager and TransactionManager
clr.AddReference(‘RevitServices’)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
Import RevitAPI
clr.AddReference(‘RevitAPI’)
import Autodesk
from Autodesk.Revit.DB import *
inputdoc = UnwrapElement(IN[0]) if isinstance(IN[0],list) else [UnwrapElement(IN[0])]
filePaths = IN[1] if isinstance(IN[01],list) else [IN[1]]
views = UnwrapElement(IN[2]) if isinstance(IN[2],list) else [UnwrapElement(IN[2])]
customscale = IN[3]
colormode = IN[4]
placement = IN[5]
unit = IN[6]
allView = IN[7]
order = IN[8]
if inputdoc[0] == None :
doc = DocumentManager.Instance.CurrentDBDocument
else : doc = inputdoc[0]
viewsplaced,outName,CADlinktype,importinstance = ,,,
options = DWGImportOptions()
options.AutoCorrectAlmostVHLines = True
options.OrientToView = True
if allView :options.ThisViewOnly = False
else: options.ThisViewOnly = True
options.VisibleLayersOnly = True
options.CustomScale = customscale
if colormode == None: ImportColorMode.Preserved
else: options.ColorMode = colormode
if placement == None: ImportPlacement.Shared
else :options.Placement= placement
if unit == None : ImportUnit.Default
else : options.Unit = unit
Create ElementId / .NET object
linkedElem = clr.ReferenceElementId
TransactionManager.Instance.ForceCloseTransaction()
TransactionManager.Instance.EnsureInTransaction(doc)
for view in range(len(views)):
doc.Import(filePaths[view], options, views[view], linkedElem)
viewsplaced.append(views[view])
importinst = doc.GetElement(linkedElem.Value)
importinstance.append(importinst)
CADLink = doc.GetElement(importinst.GetTypeId())
CADlinktype.append(CADLink)
outName.append(Element.Name.GetValue(CADLink))
if not allView :
importinst.get_Parameter(BuiltInParameter.IMPORT_BACKGROUND).Set(order)
TransactionManager.Instance.TransactionTaskDone()
if isinstance(IN[0], list): OUT = viewsplaced,outName,CADlinktype,importinstance
else: OUT = viewsplaced[0],outName[0],CADlinktype[0],importinstance[0]
I would also ask from what package tha last node comes from??
Thx againg, you’re my saviour