CAD to Revit Layers

CAD to Revit Layers

Anonymous
Not applicable
1,349 Views
1 Reply
Message 1 of 2

CAD to Revit Layers

Anonymous
Not applicable

So I'm wanting to take my CAD details & prepare them to easily convert them to Revit Line Styles. I've looked all over the forum to make sense of things, but I need someone to speak to me like a 5yr old. Don't mind if you just post links to other solutions.

 

So I want to to find a Lisp (or whatever is efficient & effective) that can create Layers by the Layer's "Color & Linetype" associated either ByLayer or ByEntity, so where "color Red=1" & so on then including the Linetype would create layers called "1 Dashed", 1 Solid", etc... & associate those lines to them....a Lisp that will look at all the Layers drawn within the file automatically & create New Layers & associate each line based on those parameters. Maybe 2 or more Lisp will be needed for this method for converting those that are ByLayer then those by ByEntity & or then by Linetypes?

 

Since Revit uses "Styles" or I have mine based on Purpose use like Site Boundary, Hidden, Overhead, Beyond, etc..but for the details when not Component based, then AIA/NCS Layer Styles of Thin, Medium, Wide, etc..which I then convert (in the rare cases of Lulls between Project Stages) line based to component based Revit details to make it intelligent for adapting to data changes in documenting for project specific purposes. 

 

This way a "1 Dashed" may either represent an Overhead or Flashing I can run a utility that will automatically with my choosing specify to switch the Style "1 Dashed" be now called either Hidden or Overhead for example. Or if time is of the essence I can update the "Style" (CAD Layers Exploded in Revit into Line Styles) to have a particular "Pen Weight" & "Linetype" assigned to those Styles.

0 Likes
Accepted solutions (1)
1,350 Views
1 Reply
Reply (1)
Message 2 of 2

Ranjit_Singh
Advisor
Advisor
Accepted solution

Try below code on a test drawing first. Minimal testing. No error trap. You may also find this post helpful.

(defun c:somefunc  (/ ctr ent etdata etdata2 la ss1 val val2 val3)
 (while (setq la (tblnext "layer" (null la)))
  (setq etdata (entget (tblobjname "layer" (cdr (assoc 2 la)))))
  (entmod
   (subst (cons 2 (strcat (itoa (cdr (assoc 62 la))) " " (cdr (assoc 6 la)))) (assoc 2 etdata) etdata)))
 (setq ctr -1
       ss1 (ssget "_x"))
 (repeat (sslength ss1)
  (setq etdata  (entget (setq ent (ssname ss1 (setq ctr (1+ ctr)))))
        etdata2 (entget (tblobjname "layer" (cdr (assoc 8 etdata)))))
  (cond ((setq val (assoc 62 etdata))
         (entmake (subst (cons 2
                               (setq val2 (strcat (itoa (cdr val))
                                                  " "
                                                  (if (setq val3 (cdr (assoc 6 etdata)))
                                                   val3
                                                   (cdr (assoc 6 etdata2))))))
                         (assoc 2 etdata2)
                         etdata2))
         (entmod (subst (cons 8 val2) (assoc 8 etdata) etdata)))
        ((setq val (assoc 6 etdata))
         (entmake (subst (cons 2
                               (setq val2 (strcat (if (setq val3 (cdr (assoc 62 etdata)))
                                                   (itoa val3)
                                                   (itoa (cdr (assoc 62 etdata2))))
                                                  " "
                                                  (cdr val))))
                         (assoc 2 etdata2)
                         etdata2))
         (entmod (subst (cons 8 val2) (assoc 8 etdata) etdata)))
        (t
         (entmod (subst (cons 8 (strcat (itoa (cdr (assoc 62 etdata2))) " " (cdr (assoc 6 etdata2))))
                        (assoc 8 etdata)
                        etdata)))))
 (princ))

ACAD_2_REVIT.gif