Is this a bug?

Is this a bug?

Anonymous
Not applicable
346 Views
13 Replies
Message 1 of 14

Is this a bug?

Anonymous
Not applicable
Command: !aa
("a" "b" "c" "d")

Command: (subst "xx" "z" aa)
("a" "b" "c" "d")

Command: (= aa (subst "xx" "z" aa))
nil

I was expecting a 'T'. Is this a bug or am I misunderstanding something?
0 Likes
347 Views
13 Replies
Replies (13)
Message 2 of 14

Anonymous
Not applicable
I'll bet (equal aa (subst "xx" "z" aa)) returns T.

Mark Holder

Jon Crouch wrote:

> Command: !aa
> ("a" "b" "c" "d")
>
> Command: (subst "xx" "z" aa)
> ("a" "b" "c" "d")
>
> Command: (= aa (subst "xx" "z" aa))
> nil
>
> I was expecting a 'T'. Is this a bug or am I misunderstanding something?
0 Likes
Message 3 of 14

Anonymous
Not applicable
Jon,

This is how you could do it:

(setq aa (list "a" "b" "c" "d"))
(setq aa (subst "z" (car aa) aa))

"aa" now = ("z" "b" "c" "d")

Of course add to it to accomplish what you're after

Jon Crouch wrote in message <[email protected]>...
>Command: !aa
>("a" "b" "c" "d")
>
>Command: (subst "xx" "z" aa)
>("a" "b" "c" "d")
>
>Command: (= aa (subst "xx" "z" aa))
>nil
>
>I was expecting a 'T'. Is this a bug or am I misunderstanding something?
>
>
0 Likes
Message 4 of 14

Anonymous
Not applicable
The (=) function does not compare list contents, it
just tells whether the two arguments are the same
list.

Try:

(equal aaa (subst "xx" "z" aa))

Jon Crouch wrote:
>
> Command: !aa
> ("a" "b" "c" "d")
>
> Command: (subst "xx" "z" aa)
> ("a" "b" "c" "d")
>
> Command: (= aa (subst "xx" "z" aa))
> nil
>
> I was expecting a 'T'. Is this a bug or am I misunderstanding something?

--
/*********************************************************/
/* Tony Tanzillo Design Automation Consulting */
/* Programming & Customization for AutoCAD & Compatibles */
/* ----------------------------------------------------- */
/* [email protected] */
/* http://ourworld.compuserve.com/homepages/tonyt */
/*********************************************************/
0 Likes
Message 5 of 14

Anonymous
Not applicable
Jon;

Following is a cut and paste from ACAD help on =/eq/equal and might give you
an idea...

The "=" function works only for numbers and strings, thus:

Command: (= aa (subst "xx" "z" aa))
nil

The eq function determines whether expr1 and expr2 are bound to the same
object (by setq, for example). Returns T if the two expressions are
identical, and returns nil otherwise.

Command: (eq aa (subst "xx" "z" aa))
nil

but the equal function determines whether expr1 and expr2 evaluate to the
same thing.

Command: (equal aa (subst "xx" "z" aa))
T

:-)

Bo Nielsen

Jon Crouch wrote in message
news:[email protected]...
> Command: !aa
> ("a" "b" "c" "d")
>
> Command: (subst "xx" "z" aa)
> ("a" "b" "c" "d")
>
> Command: (= aa (subst "xx" "z" aa))
> nil
>
> I was expecting a 'T'. Is this a bug or am I misunderstanding something?
>
>
0 Likes
Message 6 of 14

Anonymous
Not applicable
Tony,
would you try this:

(setq a nil b nil)
(repeat 5000 (setq a (cons 0 a) b (cons 0 b))
(equal a b)

R14.01 vanishes on any larger number but return T on, say 4000
0 Likes
Message 7 of 14

Anonymous
Not applicable
More precisely, 4656/4657:

Command: (setq a nil b nil)(repeat 4656(setq a(cons 0 a)b(cons 0
b))(equal a b))
T

Command: (setq a nil b nil)(repeat 4657(setq a(cons 0 a)b(cons 0
b))(equal a b))
Unexpected exception in lisp main!
*Cancel*
__
Quan Kieu wrote in message
news:[email protected]...
> Tony,
> would you try this:
>
> (setq a nil b nil)
> (repeat 5000 (setq a (cons 0 a) b (cons 0 b))
> (equal a b)
>
> R14.01 vanishes on any larger number but return T on, say 4000
>
>
0 Likes
Message 8 of 14

Anonymous
Not applicable
If precision is set to 4 (default value) for a dimstyle this routine will
return nil, anyother precesion setting and the routine returns the dimdec
sys var for that sytle.

(defun C:test (/ diminfo dimprec)
(setq
diminfo (entget (tblobjname "DIMSTYLE" "STANDARD"))
dimprec (cdr (assoc 271 diminfo))
)
dimprec
)

--
Ken Alexander
Acad 2000
Win 2000
0 Likes
Message 9 of 14

Anonymous
Not applicable
I find the 271 info for the dimstyle when I do this:

(setq
diminfo (tblsearch "DIMSTYLE" "STANDARD")
dimprec (cdr (assoc 271 diminfo))
)

--
Kevin Nehls


"Ken Alexander" wrote in message
news:[email protected]...
> If precision is set to 4 (default value) for a dimstyle this routine will
> return nil, anyother precesion setting and the routine returns the dimdec
> sys var for that sytle.
>
> (defun C:test (/ diminfo dimprec)
> (setq
> diminfo (entget (tblobjname "DIMSTYLE" "STANDARD"))
> dimprec (cdr (assoc 271 diminfo))
> )
> dimprec
> )
>
> --
> Ken Alexander
> Acad 2000
> Win 2000
>
0 Likes
Message 10 of 14

Anonymous
Not applicable
Strange, I can not get 4 returned in any dimstyle I make, always get nil.

--
Ken Alexander
Acad 2000
Win 2000
"Kevin Nehls" wrote in message
news:[email protected]...
> I find the 271 info for the dimstyle when I do this:
>
> (setq
> diminfo (tblsearch "DIMSTYLE" "STANDARD")
> dimprec (cdr (assoc 271 diminfo))
> )
>
> --
> Kevin Nehls
>
>
> "Ken Alexander" wrote in message
> news:[email protected]...
> > If precision is set to 4 (default value) for a dimstyle this routine
will
> > return nil, anyother precesion setting and the routine returns the
dimdec
> > sys var for that sytle.
> >
> > (defun C:test (/ diminfo dimprec)
> > (setq
> > diminfo (entget (tblobjname "DIMSTYLE" "STANDARD"))
> > dimprec (cdr (assoc 271 diminfo))
> > )
> > dimprec
> > )
> >
> > --
> > Ken Alexander
> > Acad 2000
> > Win 2000
> >
>
>
0 Likes
Message 11 of 14

Anonymous
Not applicable
If it's not in the (entget (tblobjname...)) then as Kevin says, look for it via
(tblsearch). You can change its value by appending '(271 . #) to the (entget
...) and (entmod)ing it.

--
John Uhden, Cadlantic/formerly CADvantage
http://www.cadlantic.com
Sea Girt, NJ


"Ken Alexander" wrote in message
news:[email protected]...
> If precision is set to 4 (default value) for a dimstyle this routine will
> return nil, anyother precesion setting and the routine returns the dimdec
> sys var for that sytle.
>
> (defun C:test (/ diminfo dimprec)
> (setq
> diminfo (entget (tblobjname "DIMSTYLE" "STANDARD"))
> dimprec (cdr (assoc 271 diminfo))
> )
> dimprec
> )
>
> --
> Ken Alexander
> Acad 2000
> Win 2000
>
0 Likes
Message 12 of 14

Anonymous
Not applicable
Sorry Kevin, should have looked at your post better.
Using tblsearch works. So am I correct in saying that
defaults aren't listed in the entity lists?

--
Ken Alexander
Acad 2000
Win 2000
"Kevin Nehls" wrote in message
news:[email protected]...
> I find the 271 info for the dimstyle when I do this:
>
> (setq
> diminfo (tblsearch "DIMSTYLE" "STANDARD")
> dimprec (cdr (assoc 271 diminfo))
> )
>
> --
> Kevin Nehls
>
>
> "Ken Alexander" wrote in message
> news:[email protected]...
> > If precision is set to 4 (default value) for a dimstyle this routine
will
> > return nil, anyother precesion setting and the routine returns the
dimdec
> > sys var for that sytle.
> >
> > (defun C:test (/ diminfo dimprec)
> > (setq
> > diminfo (entget (tblobjname "DIMSTYLE" "STANDARD"))
> > dimprec (cdr (assoc 271 diminfo))
> > )
> > dimprec
> > )
> >
> > --
> > Ken Alexander
> > Acad 2000
> > Win 2000
> >
>
>
0 Likes
Message 13 of 14

Anonymous
Not applicable
Some items are in the list returned by (tblsearch ...), some other items
are in the list returned by (entget (tblobjname ...)), and some items
aren't available in any list if they are set to the default value. For
AutoCAD 2000 and 2000i:

(setq TblsearchList (tblsearch "DIMSTYLE" StyleName)
TblobjnameList (entget (tblobjname "DIMSTYLE" StyleName))
DefaultList (list '(79 . 0) ; DIMAZIN
'(148 . 0) ; DIMALTRND
(cons 179 (getvar "DIMADEC")) ; DIMADEC
'(276 . 0) ; DIMFRAC
'(277 . 2) ; DIMLUNIT
'(278 . ".") ; DIMDSEP
'(279 . 0) ; DIMTMOVE
'(289 . 3) ; DIMATFIT
'(341 . "") ; DIMLDRBLK
'(342 . "") ; DIMBLK
'(343 . "") ; DIMBLK1
'(344 . "") ; DIMBLK2
'(371 . -2) ; DIMLWD
'(372 . -2) ; DIMLWE
)
)

Then you search those three lists, in the order in which they were
created, until you find what you want and stop searching.

This also works for AutoCAD 2002 except I'm not positive that it always
returns the correct value of DIMADEC (the handling of which changed in
AutoCAD 2002).

See the download page at http://www.fleming-group.com for a program that
returns a list of all the settings of a dimension style in one list.

jrf
Member of the Autodesk Discussion Forum Moderator Program
Please do not email questions unless you wish to hire my services

In article <[email protected]>, Ken
Alexander wrote:
> Sorry Kevin, should have looked at your post better.
> Using tblsearch works. So am I correct in saying that
> defaults aren't listed in the entity lists?
>
> --
> Ken Alexander
> Acad 2000
> Win 2000
> "Kevin Nehls" wrote in message
> news:[email protected]...
> > I find the 271 info for the dimstyle when I do this:
> >
> > (setq
> > diminfo (tblsearch "DIMSTYLE" "STANDARD")
> > dimprec (cdr (assoc 271 diminfo))
> > )
> >
> > --
> > Kevin Nehls
> >
> >
> > "Ken Alexander" wrote in message
> > news:[email protected]...
> > > If precision is set to 4 (default value) for a dimstyle this routine
> will
> > > return nil, anyother precesion setting and the routine returns the
> dimdec
> > > sys var for that sytle.
> > >
> > > (defun C:test (/ diminfo dimprec)
> > > (setq
> > > diminfo (entget (tblobjname "DIMSTYLE" "STANDARD"))
> > > dimprec (cdr (assoc 271 diminfo))
> > > )
> > > dimprec
> > > )
> > >
> > > --
> > > Ken Alexander
> > > Acad 2000
> > > Win 2000
> > >
> >
> >
>
0 Likes
Message 14 of 14

Anonymous
Not applicable
Thanks Jon

--
Ken Alexander
Acad 2000
Win 2000
"Jon Fleming" wrote in message
news:[email protected]...
> Some items are in the list returned by (tblsearch ...), some other items
> are in the list returned by (entget (tblobjname ...)), and some items
> aren't available in any list if they are set to the default value. For
> AutoCAD 2000 and 2000i:
>
> (setq TblsearchList (tblsearch "DIMSTYLE" StyleName)
> TblobjnameList (entget (tblobjname "DIMSTYLE" StyleName))
> DefaultList (list '(79 . 0) ; DIMAZIN
> '(148 . 0) ; DIMALTRND
> (cons 179 (getvar "DIMADEC")) ; DIMADEC
> '(276 . 0) ; DIMFRAC
> '(277 . 2) ; DIMLUNIT
> '(278 . ".") ; DIMDSEP
> '(279 . 0) ; DIMTMOVE
> '(289 . 3) ; DIMATFIT
> '(341 . "") ; DIMLDRBLK
> '(342 . "") ; DIMBLK
> '(343 . "") ; DIMBLK1
> '(344 . "") ; DIMBLK2
> '(371 . -2) ; DIMLWD
> '(372 . -2) ; DIMLWE
> )
> )
>
> Then you search those three lists, in the order in which they were
> created, until you find what you want and stop searching.
>
> This also works for AutoCAD 2002 except I'm not positive that it always
> returns the correct value of DIMADEC (the handling of which changed in
> AutoCAD 2002).
>
> See the download page at http://www.fleming-group.com for a program that
> returns a list of all the settings of a dimension style in one list.
>
> jrf
> Member of the Autodesk Discussion Forum Moderator Program
> Please do not email questions unless you wish to hire my services
>
> In article <[email protected]>, Ken
> Alexander wrote:
> > Sorry Kevin, should have looked at your post better.
> > Using tblsearch works. So am I correct in saying that
> > defaults aren't listed in the entity lists?
> >
> > --
> > Ken Alexander
> > Acad 2000
> > Win 2000
> > "Kevin Nehls" wrote in message
> > news:[email protected]...
> > > I find the 271 info for the dimstyle when I do this:
> > >
> > > (setq
> > > diminfo (tblsearch "DIMSTYLE" "STANDARD")
> > > dimprec (cdr (assoc 271 diminfo))
> > > )
> > >
> > > --
> > > Kevin Nehls
> > >
> > >
> > > "Ken Alexander" wrote in message
> > > news:[email protected]...
> > > > If precision is set to 4 (default value) for a dimstyle this routine
> > will
> > > > return nil, anyother precesion setting and the routine returns the
> > dimdec
> > > > sys var for that sytle.
> > > >
> > > > (defun C:test (/ diminfo dimprec)
> > > > (setq
> > > > diminfo (entget (tblobjname "DIMSTYLE" "STANDARD"))
> > > > dimprec (cdr (assoc 271 diminfo))
> > > > )
> > > > dimprec
> > > > )
> > > >
> > > > --
> > > > Ken Alexander
> > > > Acad 2000
> > > > Win 2000
> > > >
> > >
> > >
> >
>
>
0 Likes