jakebullet70 Posted December 16, 2008 Posted December 16, 2008 Hi all! (using Acad 2007) Ok - I am inserting a block into a existing drawing. The block is basically a line with a 'X x' placeholder. Now each 'X x' is suppose to get replaced with text to show inches and a fraction. How do I do that? I have already calc'd the inches and fraction so that is not a problem, its just how to replace the 'X x' with the text I am new to Autocad and just learning about layers. In fact the blocks get inserted on there own layers. Thanks again for all the help!!! Steve AKA: confusion is my middle name Quote
BIGAL Posted December 17, 2008 Posted December 17, 2008 I take you know the values in vba program so adding the attributes is something like this txtx1 = CStr(FormatNumber(pt1(0), 3)) TXTY1 = CStr(FormatNumber(pt1(1), 3)) attribs(1).TextString = txtx1 attribs(2).TextString = TXTY1 attribs(1).Update attribs(2).Update i am sure if you search here you will find an example of inserting a block with attributes Did you check the Autocad tutorials on your PC I would have thought that it would be there. Quote
jakebullet70 Posted December 18, 2008 Author Posted December 18, 2008 Thanks - that points me in the right direction! Quote
jakebullet70 Posted December 23, 2008 Author Posted December 23, 2008 OK - still having fun (read problems) with this... When I insert my block it inserts fine. I use: Set oJustInsertedBlock = ThisDrawing.ModelSpace.InsertBlock((insertionPnt, blockpath, 1#, 1#, 1#, rotateAngle) This returns a block reference just fine. I then do: vAttr = oJustInsertedBlock.GetAttributes But this is returning a blank... So I did a check with Debug.Print oJustInsertedBlock.HasAttributes This came up false to that tells me why GetAttributes is failing. I then loaded the inserted block by itself and did a Attribute Extraction and sure enough, there is one attribute and its the one I want. I see the X x text that I need to replace and the name of it. Don't know why I can't see it though after I insert it... Help... Quote
jakebullet70 Posted December 23, 2008 Author Posted December 23, 2008 WOW... Ok here it is... Found this on the web 'You're not inserting a block here, you're inserting a drawing which consists of a block reference with attributes. Once you do this the inserted drawing becomes a block in the parent drawing.' so... For Each ent In ThisDrawing.Blocks.Item(blkRef.Name) If TypeOf ent Is AcadBlockReference Then Set blkRef2 = ent If blkRef2.HasAttributes Then MsgBox "bingo" End If End If Next ent I ran this as a test and yep! I found my attribute! Quote
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.