Revit Architecture Forum
Welcome to Autodesk’s Revit Architecture Forums. Share your knowledge, ask questions, and explore popular Revit Architecture topics.
abbrechen
Suchergebnisse werden angezeigt für 
Anzeigen  nur  | Stattdessen suchen nach 
Meintest du: 

Query of Objects inside an inserted DWG-file

11 ANTWORTEN 11
Antworten
Nachricht 1 von 12
babysatch
896 Aufrufe, 11 Antworten

Query of Objects inside an inserted DWG-file

Hi,

 

I encounter the following problen, which I unfortunately cannot solve:

 

I have a DWG-File containing 13 closed polylines (see the figure).

 

Fig1.jpg

 

After I import the file into Revit, some of the polylines are sticked together and will be recognized as one line in case of a query. E. g. these two:

 

 

Fig2.jpg

 

You find both dwg-file and rvt-file attached.

 

The background of my question ist that I want to work with the geometry of these 13 closed polylines. But revit reconizes fewer than 13 polylines.

 

I would be grateful of any help?

 

 

 

11 ANTWORTEN 11
Nachricht 2 von 12
ToanDN
als Antwort auf: babysatch

Make each polyline a block.

 

 

Nachricht 3 von 12
Sahay_R
als Antwort auf: babysatch

Wouldn't separate layers for each polyline do the same thing?


Rina Sahay
Autodesk Expert Elite
Revit Architecture Certified Professional

If you find my post interesting, feel free to give a Kudo.
If it solves your problem, please click Accept to enhance the Forum.
Nachricht 4 von 12
babysatch
als Antwort auf: Sahay_R

...unfortunately not.

Nachricht 5 von 12
ToanDN
als Antwort auf: babysatch

Have you tried the files I uploaded?
Nachricht 6 von 12
babysatch
als Antwort auf: ToanDN

yes and thank you.

 

But actually if I have thousands of such polygones I have to go through them one by one and it's very time consuming.

 

But thank you any way.

 

I think it is a fundamental problem of Revit.

Nachricht 7 von 12
ToanDN
als Antwort auf: babysatch


@babysatch wrote:

yes and thank you.

 

But actually if I have thousands of such polygones I have to go through them one by one and it's very time consuming.

 

But thank you any way.

 

I think it is a fundamental problem of Revit.


Here is another way to make them come in Revit as individual objects a lot faster.  See below:

 

Nachricht 8 von 12
babysatch
als Antwort auf: ToanDN

Hi ToanDN,

 

thank you so much for your screen cast. Actually I want to get the curves (closed polylines) out of the imported instance in Dynamo in order to creat floors. But I've noticed once you convert them into regions, block or what so ever the recognition of those elements in Dynamo fails and it returns an empty list.

 

The only way I know of is to put every closed polyline on a seperate layer, which is also time consuming, by the way many thanks to @Sahay_R. It would thus be nice to know how I could do it with a lisp routine which automatically counts the objects, creates so many layers and the then assign each polyline to one of those layers uniquely.

 

 

 

 

Nachricht 9 von 12
Orsolya.Balazs
als Antwort auf: babysatch

Hi,

 

An option would be to workaround this situation through setting the polylines (or at least one from the problematic pairs) to a different layer. Polylines from different layers won't be merged together in Revit.

 

Kind regards,



Orsolya Balazs
Product Support Analyst - AEC
Autodesk, Inc.

Nachricht 10 von 12
babysatch
als Antwort auf: Orsolya.Balazs

Dear Orsolya,

 
thank you for your reply.
 
The problem I've described is actually part of a much bigger problem. 
 
Imagine I have hundreds of such polylines, which I use for my computational design in Dynamo. I do have to handle some kind of big data. Detecting problematic polylines and then putting each of them on a separate layer would be very time consuming.
 
At this point I need either a hotfix for Revit which would solve the problem or e. g. a lisp routine for AutoCAD as a temporary solution, which would automatically count all of the polylines, create as many layers as needed and then assign each polyline to a separate layer.
 
Your idea is good, though unfortunately it doesn't work in my case.
 
I would like to ask you to be so kind and find out an ultimate solution for my issue.
 
Thank you.
 
Yours sincerely
M. Eich
Nachricht 11 von 12
David_W_Koch
als Antwort auf: babysatch

@babysatch:

Apologies for the somewhat late reply, but I am a bit behind in my reading of this forum.  The attached AutoLISP file defines a command function, PLLYR, that will process all of the main-object LWPOLYLINES (the "newer" light-weight polylines) in a drawing regardless of whether they are in Model Space or Paper Space and put each on a unique layer.  Polylines nested within a Block Reference are ignored.  The layer names start with "PLL" followed by numeral characters from 1 to the number of polylines in the file.  The numeral characters are zero-padded, so each layer name has the same number of characters.  Examples:  for eight polylines, the layers would be PLL1 through PLL8.  For 49 polylines, the layers would be PLL01 through PLL49.  For 1287 polylines, the layers would be PLL0001 through PLL1287.  No attempt is made to set any specific layer attributes (color, linetype, lineweight, etc.); default values are assigned for each.

 

If your requirements vary from the above, you could always edit the code to suit.  In particular, if you already have layers that start with "PLL" followed by numerals (or just do not want the layers to start with "PLL"), you could edit the "PLL" string in the edata (subst (cons 8 (strcat "PLL" (zeropad icount ichar))) line and substitute whatever initial layer name characters you want.

 

(defun C:PLLYR (			; No arguments.
		/ ;_ Local variables:
		edata			; Entity data of polyline being processed [association list].
		ename			; Entity name of polyline being processed.
		icount			; Current polyline being processed [integer].
		ichar			; Number of characters required for total number of polylines [integer].
		imax			; Total number of polylines to process [integer].
		sspl			; Polylines in drawing [selection set].
		zeropad			; Local subroutine to generate zero-padded string.
	       ) ;_ End arguments and local variables.
  (setq acmde (getvar "CMDECHO"))
  (setvar "CMDECHO" 0)
  
  ;;;************************************************************************
  ;;;* Local subroutine to generate zero-padded string.                     *
  ;;;************************************************************************
  (defun ZEROPAD ( ;_ Arguments:
		  inum			; Number to be converted to zero-padded string [integer].
		  ichar			; Number of characters in zero-padded string [integer].
		  / ;_ Local variables:
		  ilen			; Number of characters in integer to be converted [integer].
		  snum			; Integer to be converted as a string [string].
		 ) ;_ End arguments and local variables.
    (setq snum (itoa inum)		; String equivalent of integer to be converted.
	  ilen (strlen snum)		; Length of integer string.
    ) ;_ End setq.
    (cond				; Condition A.
      ((>= ilen ichar)			; Integer string length is greater than or equal to the padded string length.
       snum				; Return integer string, as is.
      ) ;_ End condition A1.
      (T				; Otherwise, process integer string.
       (while (< ilen ichar)		; While integer string length is less than target length...
	 (setq snum (strcat "0" snum)	; ...add "0" to front of string and...
	       ilen (1+ ilen)		; ...increment string length.
	 ) ;_ End setq.
       ) ;_ End while.
       snum				; Return final string.
      ) ;_ End condition A2.
    ) ;_ End condition A.
  ) ;_ End ZEROPAD.
  
  ;;;************************************************************************
  ;;;* Start of main routine.                                               *
  ;;;************************************************************************
  (setq	sspl   (ssget "X" '((0 . "LWPOLYLINE")))
					; Get all LWPOLYLINE objects in drawing.
	imax   (sslength sspl)		; Nunber of polylines in selection set.
	ichar  (strlen (itoa imax))	; Number of characters in polyline number.
	icount 0			; Initialize polyline counter.
  ) ;_ End setq.
  (while (setq ename (ssname sspl icount))
					; While unprocessed polylines remain, do the following.
    (setq icount (1+ icount)		; Increment polyline counter.
	  edata	 (entget ename)		; Get polyline data.
	  edata	 (subst	(cons 8 (strcat "PLL" (zeropad icount ichar)))
			(assoc 8 edata)
			edata
		 )			; Update data for new layer name.
    ) ;_ End setq.
    (entmod edata)
  ) ;_ End while.
  (setvar "CMDECHO" acmde)
  (prin1)
) ;_ End C:PLLYR.

I did not test this routine on a wide variety of files (only on one test file, that did not have much other than LWPOLYLINES and a few viewports in it), so I would recommend working on a copy of your original files so you still have the original should something go awry.


David Koch
AutoCAD Architecture and Revit User
Blog | LinkedIn
EESignature

Nachricht 12 von 12
David_W_Koch
als Antwort auf: David_W_Koch

After thinking about the ZEROPAD subroutine a little more this morning, I realized that the cond statement really was not needed; the test in the while statement would effectively prevent entering the while loop if the integer passed already had as many (or more) characters as indicated in the second argument.  Here is the streamlined version:

(defun C:PLLYR (			; No arguments.
		/ ;_ Local variables:
		edata			; Entity data of polyline being processed [association list].
		ename			; Entity name of polyline being processed.
		icount			; Current polyline being processed [integer].
		ichar			; Number of characters required for total number of polylines [integer].
		imax			; Total number of polylines to process [integer].
		sspl			; Polylines in drawing [selection set].
		zeropad			; Local subroutine to generate zero-padded string.
	       ) ;_ End arguments and local variables.
  (setq acmde (getvar "CMDECHO"))
  (setvar "CMDECHO" 0)
  
  ;;;************************************************************************
  ;;;* Local subroutine to generate zero-padded string.                     *
  ;;;************************************************************************
  (defun ZEROPAD ( ;_ Arguments:
		  inum			; Number to be converted to zero-padded string [integer].
		  ichar			; Number of characters in zero-padded string [integer].
		  / ;_ Local variables:
		  ilen			; Number of characters in integer to be converted [integer].
		  snum			; Integer to be converted as a string [string].
		 ) ;_ End arguments and local variables.
    (setq snum (itoa inum)		; String equivalent of integer to be converted.
	  ilen (strlen snum)		; Length of integer string.
    ) ;_ End setq.
    (while (< ilen ichar)		; While integer string length is less than target length...
      (setq snum (strcat "0" snum)	; ...add "0" to front of string and...
	    ilen (1+ ilen)		; ...increment string length.
      ) ;_ End setq.
    ) ;_ End while.
    snum				; Return final string.
  ) ;_ End ZEROPAD.
  
  ;;;************************************************************************
  ;;;* Start of main routine.                                               *
  ;;;************************************************************************
  (setq	sspl   (ssget "X" '((0 . "LWPOLYLINE")))
					; Get all LWPOLYLINE objects in drawing.
	imax   (sslength sspl)		; Nunber of polylines in selection set.
	ichar  (strlen (itoa imax))	; Number of characters in polyline number.
	icount 0			; Initialize polyline counter.
  ) ;_ End setq.
  (while (setq ename (ssname sspl icount))
					; While unprocessed polylines remain, do the following.
    (setq icount (1+ icount)		; Increment polyline counter.
	  edata	 (entget ename)		; Get polyline data.
	  edata	 (subst	(cons 8 (strcat "PLL" (zeropad icount ichar)))
			(assoc 8 edata)
			edata
		 )			; Update data for new layer name.
    ) ;_ End setq.
    (entmod edata)			; Update polyline.
  ) ;_ End while.
  (setvar "CMDECHO" acmde)
  (prin1)
) ;_ End C:PLLYR.

David Koch
AutoCAD Architecture and Revit User
Blog | LinkedIn
EESignature

Sie finden nicht, was Sie suchen? Fragen Sie die Community oder teilen Sie Ihr Wissen mit anderen.

In Foren veröffentlichen  

Autodesk Design & Make Report