your routine only reads the insertion point for the first block in the sel
set
if there are more than one and you're looking for one of the others, that is
why you think it's giving you the wrong insertion point.
It's giving you the right insertion point but you're giving it the wrong
block to read the insertion point from?
maybe? dunno?
"kjohn" wrote in message
news:14DE8C8C4059B007B340C9920312C21F@in.WebX.maYIadrTaRb...
> Ok, I'll post the code I use - I don't know if it'll help or not.
>
> Set AcadApp = CreateObject("Autocad.application")
> Dim Thisdrawing As AcadDocument
> FileNm = ActiveCell.Value
> Set Thisdrawing = AcadApp.Documents.Open(FileNm)
>
> AutoCAD.Application.Visible = True
> Dim Name As String
> Dim BlockRef As AcadBlockReference
> Dim ss As AcadSelectionSet
>
> 'Loop through the array NameList to see if the drawing has a block
by one of the following names - if so, select it
> NameList = Array("HZ-PIDSTP", "HZ-NSTP", "HZ-BEAVER", "HZ-STAMP",
"HZ-SSTP")
> Dim i As Integer
> i = 0
> Set ss = Thisdrawing.PickfirstSelectionSet
> ss.Clear
> Do While ss.Count = 0 And i <= 4
> Name = NameList(i)
> Set ss = Thisdrawing.PickfirstSelectionSet
> ss.Clear
> Dim vt(0 To 1) As Integer
> vt(0) = 0: vt(1) = 2
> ss.Select acSelectionSetAll, , , vt, Array("INSERT", Name)
> If ss.Count > 0 Then
> Set BlockRef = ss(0)
> End If
> i = i + 1
> Loop
>
> 'Get the coordinates of the block
> Dim BlockCoords As Variant
> Dim NewCoords(0 To 2) As Double
> Dim RasterScale As Double
> BlockCoords = BlockRef.InsertionPoint
>
>
> This is the code I use. It works perfectly fine when the block is on the
layer "DIMENSION", but when it is on another layer, it doesn't seem to work.
Maybe this is just coincidence or something. I just know that this is
bugging me - it should work! If you have any suggestions, that would be
great.
> Thanks
> "TomD" wrote in message
news:7373A983A9B1A874C37F800813B9FF8C@in.WebX.maYIadrTaRb...
> I think you're going to have give us some more info. I'm 99%
comfortable saying that there is no way the layer of the block could have
any effect on your insertion point. (I don't want to say 100%, 'cause
without details, you just never know.)
>
> If possible, describe exactly the steps leading up to and including the
point at which you're extracting the coordinates. (I've been using Acad for
over 10 years, but I just started dabbling with VBA over the last few
years.)
> "SomeGuy" wrote in message
news:f0e4e08.5@WebX.maYIadrTaRb...
> I've looked, and the drawing doesn't use UCS - it's WCS. After lots of
testing I think the problem might be that on the drawings that it's (edited)
up my coordinates for, the block reference is on a different layer. Now,
I've never really used AutoCAD before so this might just be totally wrong,
but if this is the problem - how do I fix it? (do I change the layer of the
block? change the active layer I'm on?)
> Thanks in advance!
>