Importing a specific layer from DXF to RFA

Hello everyone,

Following this topic about batch importing DWG to revit families (Is there any way to batch create families by cad block with dynamo?), I figured I could challenge myself to finally rebuild my Entourage library, and got a first script to work.

I would like to improve on it by importing only the relevant layer from each DXF, to keep the ObjectStyles list as clean as possible, but that option is not part of the Genius Loci nodes I’ve been using (Enumerate DWG import options + Import DWG).

> import clr
> # Import RevitAPI
> clr.AddReference("RevitAPI")
> import Autodesk
> from Autodesk.Revit.DB import *
> import System
> 
> #Assign your output to the OUT variable
> OUT = System.Enum.GetValues(Autodesk.Revit.DB.ImportColorMode), System.Enum.GetValues(Autodesk.Revit.DB.ImportPlacement),System.Enum.GetValues(Autodesk.Revit.DB.ImportUnit)

I searched the RevitAPI and found some lines that I feel could be relevant, but I have no idea what to do with it past this point (yeah, I can’t Python… ) :

[Autodesk.Revit.DB.BaseImportOptions]
 > GetLayerSelection
 > SetLayerSelection

So, if anyone has some pointers to either Python 101 or some relevant nodes I missed, I would be most grateful !

import_dxf.dyn (80.2 KB)