TheSwamp

Code Red => VB(A) => Topic started by: David Hall on August 24, 2021, 03:09:52 PM

Title: VBA in Microstation
Post by: David Hall on August 24, 2021, 03:09:52 PM
Anybody doing VBA in Microstation?  I am trying to insert a DWG in a DGN, and i am super close, but cant find a few MS variables
Title: Re: VBA in Microstation
Post by: JohnK on August 24, 2021, 03:26:39 PM
CmdrDuh?! Oh my, how have you been?


No to the VBA in Microstation but can I help you track them down? My VBA is super rusty and my Mirostation VBA is far worse.
Title: Re: VBA in Microstation
Post by: David Hall on August 24, 2021, 03:30:14 PM
I have been good.  Working in Dallas now, and loving it.


What I am trying to do (in Autocad speak) is insert a dwg inside the titleblock in modelspace.  What I need is to capture the min and max of modelspace so I can scale the incoming dwg to fit in the border.  Seems like this should be really easy, but I cant find anything in the object browser that will give me the extents of the design file
Title: Re: VBA in Microstation
Post by: JohnK on August 24, 2021, 04:14:51 PM
I forgot that all of MS' docs are installed and not web based. But I did find a wiki that has some examples. The best I found so far is doing some of that on a small scale (one element scale).  Just wondering if you can build an array of elements and calculate the Range of that array (I doubt it, but I don't really have access to proper docs)? ...or just step through the array and locate the biggest/smallest X/Y value of each. Those min/max should be your extents?

https://communities.bentley.com/products/microstation/w/microstation__wiki/21861/calculating-the-range-of-rotated-cells
Title: Re: VBA in Microstation
Post by: David Hall on August 24, 2021, 04:17:37 PM
I have found how to get my min/max, so now I can pick a point for lowerleft based on that value.  Now if I can figure out the dwg import piece.  Getting really close now