Just not getting it...

Just not getting it...

Anonymous
Not applicable
194 Views
3 Replies
Message 1 of 4

Just not getting it...

Anonymous
Not applicable
I am trying to reference an attribute that exists in a block called BLOCK(I
much rather have the attribute exist in my model space as a single entity
and modify that, can that be possible without blocking it?). There are
mulitple attributes in this drawing, the current tag string for this
particular one is OAL. How do I reference this attribute? I understand how
to change the tag string and update it, because I have inserted new
attributes and manipulated them, but they are already referenced in my VB
project. I am using VB6 and writing a stand alone EXE. I have also tried
getobject, but I don't understand the format on how to use it, sample code
would be great. Thanks.

I am replacing the attributes with values defined in a database, would text
boxes be better than attributes or is attributes easier to reference with
VB?

--
Regards



Bradley F. Reed
CAD Manager
BHA Group/Slater, MO
(660) 529-2227 x1123
0 Likes
195 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
First, please clarify: are you wanting to modify attribute definitions or
the value contained by attributes within block references (inserts)?

As for GetObject, add a reference to the AutoCAD 2000 Object Library then
use code similar to the following:

Dim acadApp As AcadApplication
On Error Resume Next
Set acadApp = GetObject(, "AutoCAD.Application")
If Err Then
Err.Clear
Set acadApp = CreateObject("AutoCAD.Application")
End If
If acadApp Is Nothing Then
MsgBox "Could not connect to AutoCAD"
End If

--
Good judgment comes from experience.
Experience comes from bad judgment.

http://www.acadx.com


"Brad" wrote in message
news:787DDF93D4C9146BFAC5BFB8DC4ECF48@in.WebX.maYIadrTaRb...
> I am trying to reference an attribute that exists in a block called
BLOCK(I
> much rather have the attribute exist in my model space as a single entity
> and modify that, can that be possible without blocking it?). There are
> mulitple attributes in this drawing, the current tag string for this
> particular one is OAL. How do I reference this attribute? I understand
how
> to change the tag string and update it, because I have inserted new
> attributes and manipulated them, but they are already referenced in my VB
> project. I am using VB6 and writing a stand alone EXE. I have also tried
> getobject, but I don't understand the format on how to use it, sample code
> would be great. Thanks.
>
> I am replacing the attributes with values defined in a database, would
text
> boxes be better than attributes or is attributes easier to reference with
> VB?
>
> --
> Regards
>
>
>
> Bradley F. Reed
> CAD Manager
> BHA Group/Slater, MO
> (660) 529-2227 x1123
>
>
0 Likes
Message 3 of 4

Anonymous
Not applicable
I am wanting to modify the definitions, more over the value string. What I
am ultimately trying to do is redefine the attributes in my drawing to match
the fields on our company dbase, so as to populate the fields automatically.
I assumed by inserting attributes into a template drawing, and then using VB
to reference these attributes and then change them to equal the
corresponding field on my database, would be the easier way rather than
using text, but now I am not sure. I hope this clarifies a little more of
what I am trying to do. I have connected to the drawing just fine, and have
the program opening and connecting to the correct drawing. My next step is
to reference the existing attributes, and change them to the correct value
in my textboxes which are linked to my database.


--
Regards



Bradley F. Reed
CAD Manager
BHA Group/Slater, MO
(660) 529-2227 x1123
0 Likes
Message 4 of 4

Anonymous
Not applicable
Hi Brad,

You can't connect to an object by name or anything. You just have to go
trough all objects in your drawing, check the name, and if it's the one
you're looking for you can change the object.:

Dim Obj As Object
Dim Atts
Dim AcadApp As AcadApplication

Sub Sample()
Set AcadApp = GetObject(, "Autocad.Application")

On Error Resume Next
For Each Obj In AcadApp.ActiveDocument.ModelSpace

If Obj.HasAttributes Then
Atts = Obj.GetAttributes
For a = LBound(Atts) To UBound(Atts)
Atts(a).TextString = "Changed"
Obj.Update
Next
End If

Next
End Sub


Now you have the Obj, you can extract all data from the object and change
any tagstring or textstring. Or even add things to the object, but that's a
bit tricky Be carefull trying this, all block attributes will be changed to
"Changed".

Joeri Tuyn









"Brad" wrote in message
news:B74F5F32BB7FAACCAD502A52D75AF49B@in.WebX.maYIadrTaRb...
> I am wanting to modify the definitions, more over the value string. What
I
> am ultimately trying to do is redefine the attributes in my drawing to
match
> the fields on our company dbase, so as to populate the fields
automatically.
> I assumed by inserting attributes into a template drawing, and then using
VB
> to reference these attributes and then change them to equal the
> corresponding field on my database, would be the easier way rather than
> using text, but now I am not sure. I hope this clarifies a little more of
> what I am trying to do. I have connected to the drawing just fine, and
have
> the program opening and connecting to the correct drawing. My next step
is
> to reference the existing attributes, and change them to the correct value
> in my textboxes which are linked to my database.
>
>
> --
> Regards
>
>
>
> Bradley F. Reed
> CAD Manager
> BHA Group/Slater, MO
> (660) 529-2227 x1123
>
>
0 Likes