bigr1822 Posted August 7, 2008 Share Posted August 7, 2008 Hey All, I have searched and Search for what I am about to tell you here and can not find anything on it. There HAS to be a way. I have a Block inserted into a drawing. I want to use the "GetAttributes" Method to get the attributes of that Block, but the only way I can use that is by using the Insert Block Method. I already have the Block Inserted. Does this make any sense? Again, thanks to all of you who respond Big R Quote Link to comment Share on other sites More sharing options...
ReMark Posted August 7, 2008 Share Posted August 7, 2008 What are you going to do with the attributes that are extracted? Quote Link to comment Share on other sites More sharing options...
neekcotrack Posted August 7, 2008 Share Posted August 7, 2008 Have you tried on the command line typing battman or bedit. It depends what you are trying to do which one you use. Quote Link to comment Share on other sites More sharing options...
ReMark Posted August 7, 2008 Share Posted August 7, 2008 I would imagine that over the years there have been numerous routines written that include attribute extraction. Why the emphasis on using 'GetAttributes'? Please forgive my lack of knowledge. Quote Link to comment Share on other sites More sharing options...
bigr1822 Posted August 7, 2008 Author Share Posted August 7, 2008 Sorry Guys, again I failed to get you enough info. First I am using VB6 to accomplish this. Secondly, what I am trying to do exactly is this. We put info into a database for our TitleBlocks. I have already figured out how to store that info into a user form. Now, what I need to do is put that info into the attributes of that specific block. Again, I have figured that out, but only by inserting the block over and over again. Now I have multiple Block References, I think, or Blocks, with the old attr's and the new attr's??? Hope this makes more sense? Big R Quote Link to comment Share on other sites More sharing options...
CmdrDuh Posted August 7, 2008 Share Posted August 7, 2008 actual VB6 or VBA? Quote Link to comment Share on other sites More sharing options...
borgunit Posted August 7, 2008 Share Posted August 7, 2008 It seems simple enough. Just get a selection set of the blocks or set a BlockRef object to the one you want then do a .getattributes on the block and then change the attrbute by its tag. Public Function SetBlkAttByTag(ByRef vAtts As Variant, ByVal sTag As String, _ Optional sTxt As String = "") As Boolean '------------------------------------------------------------------------------ 'Set attribute textstring 'Arguments: vAtts - variant list of acadAttributes ' sTag - Tag name to look for ' sTxt - attribute text , defaults to non-null (space) 'Returns: NA 'Revisions: Added vTxt to allow Empty to be used to avoid error when setting ' TextString to empty string 20080506 '------------------------------------------------------------------------------ Dim acAtt As AcadAttributeReference Dim lCnt As Long Dim vTxt As Variant ''''''''''''''''''''''''''''''''''''''' On Error GoTo ErrHandler If sTag = "" Then Exit Function End If vTxt = IIf(sTxt = "", Empty, sTxt) For lCnt = LBound(vAtts) To UBound(vAtts) Set acAtt = vAtts(lCnt) If acAtt.TagString = sTag Then acAtt.TextString = vTxt SetBlkAttByTag = True Exit Function End If Next lCnt ExitHere: Exit Function ErrHandler: Debug.Print Err.description & ":" & Err.Number & ":" & _ "Function 'SetBlkAttByTag' Failed" End Function Quote Link to comment Share on other sites More sharing options...
bigr1822 Posted August 7, 2008 Author Share Posted August 7, 2008 borgunit, I am going to show my ignorance here. This is a Function, so I created a Sub to call this function and I can not get it to run, what am I doing wrong??? Big R Quote Link to comment Share on other sites More sharing options...
bigr1822 Posted August 7, 2008 Author Share Posted August 7, 2008 Ok, I got it to run. Quote Link to comment Share on other sites More sharing options...
borgunit Posted August 7, 2008 Share Posted August 7, 2008 Just an FYI, functions can return a value back to whatever calls the function. It can, but does not have to. Subs can't return a value. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted August 8, 2008 Share Posted August 8, 2008 Just a bit more as above you can search all blocks find the correct blocks with the same name if you want to only update 1 single block then you need to re-search the cut down list for a unique attribute value. Eg we have a drainage pit schedule 10 items in the block called schedtext, the first attibute is always unique its the pit name and is not repeated so find all schedtxt's then search for correct pitname change attributes all done. We pick a block to get name and then update schedtxt and the blocks are in different model & layout tabs and it all works great. Like wise I search for blocks same name but update attrib1 in all occurences (title block prelim to issued) search forum here VBA for code Quote Link to comment Share on other sites More sharing options...
bigr1822 Posted August 8, 2008 Author Share Posted August 8, 2008 Thanks to ALL of you guys!!!! I really mean that. I can't stop saying how much this site kicks butt!!! I figured out what I needed to do. I pretty much had all the code already, I just needed to modify some of it, and also took from the help files. Everyone, I hope you have a GREAT weekend! Big R over and out. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.