A better explanation of what I want to do is below;
I have a button on a form and I need it to do the following -
Check if AutoCAD is running
If AutoCAD is running, maximise it and move the focus to it
If AutoCAD is not running, start it and move the focus to it
I'm thinking this should be...
Hi, I have a button in an access database. When I press the button I want to focus on another application, then send a command to it. Is this possible?
My exact requirements are to press the button at which point some vba will run. The vba will check to see if autocad is open. If not open, it...
Thanks for all your help Todd.
I gave on on layout filtering in the end and instead decided to create a new layer named the same as the layout on which the block resides to filter by. A bit messier than I wanted but it does the job.
Chris.
Does it help that I know that there will be only one block on each layout that we are trying to update? So there will be several layouts, 001, 002, 03, etv, but each layout will have one block called for example, 'TitleBlock'. Is there no way of identifying that? For example...
I posted on another forum and this was one of the replies;
Dim Id As Long
Dim b As AcadBlockReference
Id = ThisDrawing.PaperSpace.ObjectID
For Each b In ssTitleBlock
Debug.Print b.OwnerID
If b.OwnerID = Id Then
yadayada
Is that workable?
Thanks Todd, but it doesn't work. If set to 0 it won't select anything (nothing in model space), and if set to 1 it still selects the block on the first layout rather than the current layout.
After looking around I think whats needed is a routine of some sort to filter the selection set...
It seems that code 410 for layouts does not work in VBA. I have posted another thread http://www.tek-tips.com/viewthread.cfm?qid=1397234&page=1 to see if I can find a solution.
I have run across a problem that seems to have come up a few times, but all links to helpful resources in those threads are dead. I am trying to select a particular block on the active layout, however due to the failings of code 410 in VBA, I can only select the block on the first layout.
I'm...
The layout I want to update is current before I run the script, but it still imports the record into the block on the first layout, so if I understand correctly, it can't be a problem with an existing selection set still being in memory.
So I must have to modify the selection set filter codes...
Todd,
Thank you very much for all the help you are giving me.
I have now made the following changes;
On Error GoTo ExportAttribs_Error
strTblName = "tblDrawings" ' Table name in database.
strLayoutName = ThisDrawing.ActiveLayout.Name ' Current layout name...
...itemType = "TEXT" 'this holds the type of entity we'll be collecting
fType(0) = 0: fData(0) = itemType
fType(1) = 8: fData(1) = "*" 'Here you specify the layer. We'll use all layers
DataSS.Select acSelectionSetAll, , , fType, fData
'now we cycle through all the layouts
For Each...
...End If
' HERES WHERE I NEED TO FIND THE TAB NAME AND USE IT TO IDENTIFY WHICH RECORD TO IMPORT THE ATTRIBUTES FROM ******************
' Collect the attributes.
'
varAttribs = AttribExtract(ssTitleBlock(0))
' Connect to the title block...
Hi Todd, hope you are well today.
You are almost correct in what I want to achieve, of course my description becomes clearer the more I learn. All processes will be controlled from my access database, ie; a button press or other action. Command lines and scripts will then be passed to AutoCAD...
...Connect(strDatabase As String, strTableName As String)
Dim strSQL As String 'SQL string for extracting recorsets.
strSQL = "SELECT * FROM [" & strTableName & "]"
Set cnnDataBse = New ADODB.Connection
With cnnDataBse
.CursorLocation = adUseServer
.Provider =...
I had a look for information on the error message and couldnt see anything that immediately jumped out at me, so I'm just going to forget about that part of it. I think I'll be deleting that part of the code anyway, since all I want to do is read from the database, not write to it.
I'll keep...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.