Thursday, April 16, 2009

AutoCAD Pline Widths in Revit

You want to Import or link an AutoCAD file with plines representing walls. The plines are set to the actual thickness of the wall. When this is imported into Revit the plines lose their thickness.

Changing the Revit lineweight is not the greatest solution because the lines change thickness based on scale. Also, you would have to do some calculations to get the corresponding width right.

You would be best to make the change in AutoCAD before you bring the file in. To that end I've attached a lsp routine which will convert plines to mlines with the corresponding width. You might want to add another string of code which explodes the mlines into lines because mlines don't come into Revit either.

Here's the thread where I found the lsp file written by Joe Burke...
(note: this code leaves out closed segments, you will need to change the plines to 'open'.)

Here's a cut and paste of the code...

;;;thanks Joe Burke
(defun c:lml ()

;returns list associated with a DXF code
;arguments key: DXF code, alist: object data list
(defun massoc (key alist / x nlist)
(foreach x alist
(if (eq key (car x))
(setq nlist (cons (cdr x) nlist))
(reverse nlist)
) ;end

;(setq s (ssget))
(setq s (ssget '((0 . "LINE,LWPOLYLINE"))))
(setq teller 0)
(repeat (sslength s)
(setq en (ssname s teller))
(setq ent (entget en))
(if (= "LINE" (cdr (assoc 0 ent)))
(setq PtLst (list (cdr (assoc 10 ent)) (cdr (assoc 11 ent))))
) ;if
(if (= "LWPOLYLINE" (cdr (assoc 0 ent)))
(setq PtLst (massoc 10 ent))
) ;if
(command "mline" (foreach pt PtLst (command pt))) ;point list fed to
;(command "erase" en "")
(entdel en)
(setq teller (1+ teller))
) ;repeat
) ;end

No comments: