text window text

text window text

Anonymous
Not applicable
420 Views
8 Replies
Message 1 of 9

text window text

Anonymous
Not applicable
A comment:
I know it's not exactly pretty, or 'real' programming, but for quick and dirty macros I've realized that you can turn your LogFileOn, sendcommand, for example, a list command and then LogFileOff, read the Acad.log file in as a string and grab what you're looking for. And there's easy access to numerous properties that aren't easily available to VBA.
Is there an easier or better way to do this?
0 Likes
421 Views
8 Replies
Replies (8)
Message 2 of 9

Anonymous
Not applicable
I wouldn't exactly call it easy [access to numerous
properties..], because you have to read and parse the
text. And you are right that it certainly isn't pretty.

There's really no other way to do it.

What exactly do you use this for?

"lorier" wrote in message
news:f1091dc.-1@WebX.maYIadrTaRb...
> A comment:
> I know it's not exactly pretty, or 'real' programming, but for quick and
dirty macros I've realized that you can turn your LogFileOn, sendcommand,
for example, a list command and then LogFileOff, read the Acad.log file in
as a string and grab what you're looking for. And there's easy access to
numerous properties that aren't easily available to VBA.
> Is there an easier or better way to do this?
>
0 Likes
Message 3 of 9

Anonymous
Not applicable
Tony,
With access to the text window and a copy paste to the command line, you can integrate third party software responses in vba programs. And I know you don't want to hear this 🙂 but you can also avoid third party programs. Using list or an entlist program (with unsupp or similar) you can get responses to area, length, distance, etc. and all the other queries. Basically everything that is accessible through the command line and through lisp can be available to vba. I think it's pretty wild. Something to use while vba catches up.
0 Likes
Message 4 of 9

Anonymous
Not applicable
"lorier" wrote in message
news:f1091dc.1@WebX.maYIadrTaRb...
> Tony,
> With access to the text window and a copy paste to the command line, you
can integrate third party software responses in vba programs. And I know you
don't want to hear this 🙂 but you can also avoid third party programs.
Using list or an entlist program (with unsupp or similar) you can get
responses to area, length, distance, etc. and all the other queries.
Basically everything that is accessible through the command line and through
lisp can be available to vba. I think it's pretty wild. Something to use
while vba catches up.
>

Hi. If you consider the need to avoid third party programs
more important than preventing your application from having
a highly unprofessional or amateur 'look and feel', and
more generally, from being perceived as a collection of
"hacks and kludges", that's fine.

If you want a more concrete reason for why its just a real
bad idea to "read the text window", how about the fact
that distances, angles and other formatted numeric values
are rounded off to the current display precision?

Would you be so careless as to allow distances and angles
that your code 'reads' and then uses, to be rounded off to
the current display precision?

If your answer is yes, then not only is that a fairly
bankrupt argument in defense of banning use of third
party programs, but you could also rest assured that I
would never be caught dead using anything you write.

Developing VBA applications is not about ego, or how much
of a personal accomplishment you think it is to be able to
do something without the help of a third party program, it's
about giving the people you're writing code for the best
possible solution you can give them. Solutions that resort
to the sort of kludgery and hacks like that which you are
advocating here, are about as far from "the best" as it gets.
0 Likes
Message 5 of 9

Anonymous
Not applicable
What exactly are you attempting to do [I don't believe I have read that in this thread]. Perhaps VBA doesn't need to "catch" up. I realize that there are tasks that it will not accomplish, but without knowing what you are trying to do doesn't tell me that VBA won't do the job.

Incidentially, I agree with Tony's assessment. Doing it your way is totally unacceptable, even for a kludge.

Joe
--
0 Likes
Message 6 of 9

Anonymous
Not applicable
The display precision can be adjusted, right? And the idea basically came out of the need for a version of Acadx for Acad R14 which is now unavailable.
0 Likes
Message 7 of 9

Anonymous
Not applicable
joesu,
For example, the length of a polyline. It should be in the object model, but it's not. Numerous NG users have posted questions concerning how to get the length of a polyline (which can be done with vba of course, but it's a little elaborate) and they usually get a response to download acadx. The whole idea of OOP is to not have to rewrite code or start from scratch. Why write code to determine the length of a polyline (for example) when it's accessible this way? Why reinvent the wheel? In addition, I am in the civil engineering field and using this can let me incorporate all of the AEC tools/query responses (which, as far as I know doesn't have an object model) into my vba apps.
0 Likes
Message 8 of 9

Anonymous
Not applicable
Well if that were the case, none of us would be doing anything because I doubt that ANY language has everything. It's just possible to think of every conceivable scenario. Having said that, let's talk advantage of class modules. Poke this function in a class module. Then you'll have an object that operates just as if it were built-in.

Joe
--
Public Function LengthOfPolyline() As Double
Dim Entity As AcadEntity
Dim Point As Variant
Dim Pline As AcadLWPolyline
Dim ExplodedObjects As Variant

On Error Resume Next

ThisDrawing.Utility.GetEntity Entity, Point, "Select polyline"
'nothing was selected
If Entity Is Nothing Then Exit Function

If Entity.ObjectName <> "AcDbPolyline" Then Exit Function
'cast Entity to Polyline proper
Set Pline = Entity

ExplodedObjects = Pline.Explode

'iterate through the exploded objects
Dim Index As Integer
Dim Perimeter As Double
Dim Line As AcadLine

For Index = 0 To UBound(ExplodedObjects)
Perimeter = Perimeter + ExplodedObjects(Index).Length
Set Line = ExplodedObjects(Index)
Line.Delete
Next Index

'return the length of the polyline
LengthOfPolyline = Perimeter
End Function
0 Likes
Message 9 of 9

Anonymous
Not applicable
"lorier" wrote in message
news:f1091dc.4@WebX.maYIadrTaRb...
> The display precision can be adjusted, right?

Nothing you're doing makes any sense at all. It's almost
as if you're playing some kind of game. You can easily
access just about anything you need using LISP. Or, is
LISP off limits too?

Sorry, I don't really see any point to what you're trying
to accomplish. This VBA-or-bust mentality just doesn't make
any sense to me at all.
0 Likes