.NET

.NET

Reply
Distinguished Contributor
JamieVJohnson
Posts: 136
Registered: ‎09-29-2008
Message 41 of 63 (129 Views)

Re: Trouble getting textstring from attribute definition

02-05-2009 02:44 PM in reply to: myspambox111
Whell, your probabley write, sew I think ill just teech a clas insted. Sea yew ther!



jvj
Distinguished Contributor
NathTay
Posts: 1,691
Registered: ‎12-15-2003
Message 42 of 63 (129 Views)

Re: Trouble getting textstring from attribute definition

02-05-2009 02:50 PM in reply to: myspambox111


Well put. If we needed any more proof of your hypocrisy we have it.

Contributor
myspambox111
Posts: 22
Registered: ‎10-07-2008
Message 43 of 63 (129 Views)

Re: Trouble getting textstring from attribute definition

02-05-2009 10:32 PM in reply to: myspambox111
I just wanted to say thanks to you Mikko for actually answering my question.



I don't understand the answer though.

-------------------------------------------------------------------------------------------------



Private Sub GetAttributes(ByVal NameOfBlock As String)

Dim findThis() As TypedValue = {New TypedValue(0, "INSERT"), New TypedValue(2, NameOfBlock)}

Dim sf = New SelectionFilter(findThis)

Dim psr As PromptSelectionResult = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor.SelectAll(sf)

If psr.Status = PromptStatus.OK Then

Using t As Transaction = HostApplicationServices.WorkingDatabase.TransactionManager.StartTransaction()

For Each h As ObjectId In From q As ObjectId In psr.Value.GetObjectIds()

Dim br = CType(t.GetObject(h, OpenMode.ForRead), BlockReference)

For Each k As ObjectId In br.AttributeCollection

Dim ar As AttributeReference = CType(t.GetObject(k, OpenMode.ForRead), AttributeReference)

MsgBox(ar.TextString)

Next k

Next

t.Commit()

End Using

End If

End Sub

-------------------------------------------------------------------------------------------------

I have no clue about:

Dim findThis() As TypedValue = {New TypedValue(0, "INSERT"), New TypedValue(2, NameOfBlock)}

Dim sf = New SelectionFilter(findThis)

Dim psr As PromptSelectionResult = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor.SelectAll(sf)

Is this the only way to get my block's attributes? Obviously the attributes exist when I insert them in the drawing. Can I not get them directly without searching and having a filter and a result collection? Why does this collection hold the value but not the way I did it?



Without any pissing contests, can anyone answer me this in a little more detail?

(Mikko's code is also attached as a text file for those who need it)



Thanks!

Brandon
*Paul Richardson
Message 44 of 63 (129 Views)

Re: Trouble getting textstring from attribute definition

02-06-2009 05:06 AM in reply to: myspambox111


BTW, the book in question is still
selling copies. Where's your book?

 

Sales are not the best
measureing stick to use... Shouldn't the person writing a book be expert on the
subject beyond

reproach? You would think they would be here
defending their writting and helping us out thus promoting the
books

sales further. Wonder why people aren't emailing this guy and asking him
questions - that's right because they say he

does not respond - hmmm. Tony is constantly here helping us out where
is your author again? So is anyone here

upset the dude wrote a book - of course not! The fact that he
convinced so many that they can attack this api with what

little he knows is creating people reposting his code without knowing what
they are doing and messing up this group!

 

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
BTW,
the book in question is still selling copies. Where's your
book?



Nuff said.



jvj
Distinguished Contributor
sgsawdy
Posts: 411
Registered: ‎09-19-2005
Message 45 of 63 (129 Views)

Re: Trouble getting textstring from attribute definition

02-06-2009 12:31 PM in reply to: myspambox111
Not to get into the merits of Jerry's book nor to defend it, but, every time I have written to Jerry, he has responded and has tried to help.

Scott
*Ron Barns
Message 46 of 63 (129 Views)

Re: Trouble getting textstring from attribute definition

02-06-2009 06:38 PM in reply to: myspambox111

When I read Tony Tanzillo's stupid belittling
responses I laugh because he's nothing but an old saw horse (working out of his
basement) ready for pasture.


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
That
is a jumble of irrelevant nonsense which only goes to show your true reason
for the question which is a deep hatred of Tony for belittling
you.



The quality of information you are spreading has absolutey
no connection to how nice you are. You aren't actually in a position to take
the moral high ground either with your debates with Tony it hasn't exactly
been one sided nastiness.



Please not not write a book as your
incompetence has been shown time and time again.
Distinguished Contributor
NathTay
Posts: 1,691
Registered: ‎12-15-2003
Message 47 of 63 (129 Views)

Re: Trouble getting textstring from attribute definition

02-08-2009 01:51 PM in reply to: myspambox111
You should find the answer in Jerry's book.



Basically you have not taken my advice and still have no idea about the purpose of block definitions and references.



You need to understand the basics of AutoCAD before you start programming it.
Contributor
myspambox111
Posts: 22
Registered: ‎10-07-2008
Message 48 of 63 (129 Views)

Re: Trouble getting textstring from attribute definition

02-08-2009 09:10 PM in reply to: myspambox111
I have understood it enough to write a half dozen programs and macros. I also understand that the way these concepts are explained and the approach taken has differed from one source to the next. The best reference I have had has been the arx inspector tool which I can no longer use as I've upgraded to autocad x64 and it doesn't seem to be compatible. This shows the inner working of the definitions and references but I haven't been able to use it in over a month to refresh my memory.

If anyone has the inspector tool for x64 or has a link to the download I'd appreciate it.
Distinguished Contributor
NathTay
Posts: 1,691
Registered: ‎12-15-2003
Message 49 of 63 (129 Views)

Re: Trouble getting textstring from attribute definition

02-09-2009 01:28 PM in reply to: myspambox111


The reason you have your knickers in a twist on this occasion is because you do not have an understanding of working in AutoCAD. You may have gotten away with no knowledge up to this point but the gripes you are making about how block definitions and references work is purely down to the fact you are ignorant. If you had a working knowledge of AutoCAD you would realise why things are how they are.

Contributor
myspambox111
Posts: 22
Registered: ‎10-07-2008
Message 50 of 63 (129 Views)

Re: Trouble getting textstring from attribute definition

02-10-2009 06:32 PM in reply to: myspambox111
Another senseless post by you.

Postcount+1?
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.