TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: lamarn on June 30, 2015, 05:36:40 PM

Title: Modifing insertion point for Revit DWG block output
Post by: lamarn on June 30, 2015, 05:36:40 PM
Hi

I have quite some trouble working with DWG coming from Revit. Especially how families are being translated into blocks.
Many probably probably would say: don't use DWG output in the first place, ..ok.. I know.. but sometimes it is necessary anyway
Revit make unique blocknames for every instance but at the otherhand... and insertion points is the same!!
That is quite the world upside down for a AutoCAD block user.

So I have a little challenge to modify these definitions.
On this that helps is the recent 'ssb' select similar blocks routine from Lee MAC.
BUT.. I you would use that on Revit output all the blocks will be layed upon each other.

I was thinking maybe the CBIR change block insertion routine could be rewritten to parse multiple blocks
whereas for the insertion point the center of the geometry will be used.

Anyone you understands this story and have any idea (for other workarounds), I would appriate it.
Thanks
Hans

**
ATTACHED: THE VARIANT OF LEE MAC ROUTINE THAT CAN BE FOUND AT http://lee-mac.com/changeblockinsertion.html
PLEASE READ THE COMMENTS TO GET THIS ANY FURTHER. THANKS
**



Title: Re: Modifing insertion point for Revit DWG block output
Post by: Rod on June 30, 2015, 07:13:23 PM
Hans,
If I understand you correctly that seems doable.
You could use the similarity of the block names to aid in selecting the blocks or inspect the extended data of the objects themselves. See (entget(car(entsel))'("REVIT")).
You will need to test this extended data further to see how it helps.
Rod
Title: Re: Modifing insertion point for Revit DWG block output
Post by: NICK_VNV on July 01, 2015, 02:05:49 AM
..I was thinking maybe the CBIR change block insertion routine could be rewritten to parse multiple blocks
whereas for the insertion point the center of the geometry will be used.

Anyone you understands this story and have any idea (for other workarounds), I would appriate it.
Thanks
Hans
Do you mean Lee's CBBR command? It uses "LM:changeblockbasepoint" function so look there, it can be easily modified for change insertion point for each block in selection to the center of it's bounding box.
Title: Re: Modifing insertion point for Revit DWG block output
Post by: Lee Mac on July 01, 2015, 04:21:34 AM
Certainly possible - I'll take a look when I get some time.
Title: Re: Modifing insertion point for Revit DWG block output
Post by: lamarn on July 01, 2015, 07:55:04 AM
That's the one! :)
But my lisp tricks are as bad as my written English so I could use some little help along the way :)
cheers
Title: Re: Modifing insertion point for Revit DWG block output
Post by: lamarn on July 02, 2015, 05:00:57 PM
I am thinking about how this routine can be converted to the following

http://lee-mac.com/lisp/html/ChangeBlockBasePointV1-5.html

Especially, this line of text:

Code: [Select]
(if (and (= 'ename (type ent)) (setq nbp (getpoint "\nSpecify New Base Point: ")))

- modus : the bounding box of the geometry can be used to modify insbase of the block. How to achieve it?

How can a point (e.g. left, under) be acquired from a bounding box? like in line
Code: [Select]
(vla-getBoundingBox (vlax-ename->vla-object e) 'll 'ur)
source: http://www.cadtutor.net/forum/showthread.php?54046-Bounding-Box-LISP


(- next thing then would be to get it to work on multiple picked blocks ..)

Thanks in regard
Title: Re: Modifing insertion point for Revit DWG block output
Post by: roy_043 on July 03, 2015, 04:09:50 AM
The last two arguments of the vla-getBoundingBox function are quoted variables. After running the function these variables will contain the coordinates of the corners of the bounding box.
Code - Auto/Visual Lisp: [Select]
  1. (vlax-invoke (vlax-ename->vla-object e) 'getboundingbox 'ptMin 'ptMax)
  2. (print ptMin)
Title: Re: Modifing insertion point for Revit DWG block output
Post by: lamarn on July 05, 2015, 04:08:16 PM
In the first post I attached my .lsp file in an attempt to get this working.

Code: [Select]
(if (= 'ename (type ent))
 
;; (vlax-invoke (vlax-ename->vla-object e) ; how does this work exactly?
   
        (progn
 
  (vla-getboundingbox ent 'minpoint 'maxpoint)                  ; something like it, but will not work on block definition
  (vlax-safearray->list minpoint) ; will not work on blocks
  (print minpoint) ; will not work on blocks
  (setq nbp minpoint) ; that would be the idea

Title: Re: Modifing insertion point for Revit DWG block output
Post by: Lee Mac on July 05, 2015, 05:45:33 PM
Certainly possible - I'll take a look when I get some time.

Please be patient  :-)
Title: Re: Modifing insertion point for Revit DWG block output
Post by: lamarn on July 06, 2015, 12:59:09 AM
Ok !!! 😅
Title: Re: Modifing insertion point for Revit DWG block output
Post by: Lee Mac on August 01, 2015, 05:35:31 PM
Please try my new Justify Block Base Point (http://bit.ly/1eL66PW) program  :-)
Title: Re: Modifing insertion point for Revit DWG block output
Post by: lamarn on August 02, 2015, 05:01:33 PM
There are some wishes left in regards to select similar blocks with different names but JBP really helps working with DWG blocks from Revit.
Now quite easily blocks can be replaced. See this little demo

https://www.youtube.com/watch?v=qieQbNgFrXE