Issue when running Autocad in invisible mode

Issue when running Autocad in invisible mode

juanjogo
Contributor Contributor
1,294 Views
3 Replies
Message 1 of 4

Issue when running Autocad in invisible mode

juanjogo
Contributor
Contributor

Hello everyone,

 

I'm having an issue when running Autocad in invisible mode from excel (i.e. AcadApp.Visible = False). I wrote some code that extracts text information in dwg drawings. It uses areas and filters to identify certain lines and based on that, extract selected text. The problem is that when ever I run the code keeping Autocad visible it works fine, and extracts all the information it should, but when I run it in invisible mode it does not recognize some of the lines and can't seem to extract all the information.

I'm pasting a part of the code, but I doubt there's a problem with it because as I said previously the program works just fine when the Autocad window is visible; I'm just wondering if anyone has had a similar issue and how it can be fixed. 

 

Err.Clear
On Error Resume Next
Set Area = tAcadDoc.SelectionSets("temporal3")
If Err Then
Set Area = tAcadDoc.SelectionSets.Add("temporal3")
End If

FilterType2(0) = 0
FilterData2(0) = "Line"
passgroup2 = FilterType2
passvalue2 = FilterData2
modo = acSelectionSetCrossing

ptoup1(0) = coorx
ptoup1(1) = coory
ptoup1(2) = coorz
ptodw1(0) = 10
ptodw1(1) = coory - altura
ptodw1(2) = coorz

Area.Clear
Area.Select modo, ptoup1, ptodw1, passgroup2, passvalue2

For Each elemento3 In Area
   If elemento3.ObjectName = "AcDbLine" Then
      numlinea = numlinea + 1
      ReDim Preserve lineax(1 To numlinea)
      lineax(numlinea) = cant3.StartPoint(0)
   End If
Next

 

0 Likes
1,295 Views
3 Replies
Replies (3)
Message 2 of 4

hgasty1001
Advisor
Advisor

Hi,

 

As you are selecting objects using "crossing" (and any other visual selection such as fence, window, etc) , you have to ensure the objects and the points of the crossing border are included in the "visible" area of the Autocad screen editor. So you may need to zoom to the extent of the objects involved, or a full zoom extent before selection. I'm not sure if this apply in the case Autocad screen is invisible.

 

Gaston Nunez

 

 

0 Likes
Message 3 of 4

juanjogo
Contributor
Contributor

Thank you Gaston, that's helpful. I'll have to look for an alternate function for selection. You wouldn't happen to know if there are filter types that don't rely on the elements displayed would you? 

0 Likes
Message 4 of 4

hgasty1001
Advisor
Advisor

Hi,

 

None that i'm aware, only the database level filters (object name, class, properties, etc)  work everywhere without the need to be on display.

 

Gaston Nunez

 

0 Likes