TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Kerry on October 21, 2010, 07:35:23 PM

Title: Non planar coordinate weirdness with commands.
Post by: Kerry on October 21, 2010, 07:35:23 PM
I've come across some intermittent weirdness in the last couple of days that I haven't noticed previously
This is with ACADM 2011 SP1

This issue is with both code and command line commands.

I have to draw a circle with a center at Z other than current UCS

Code: [Select]
(setq Startgap 20.0
      Odmain   100
)
(vl-cmdf "_.Circle" (List 0. 0. Startgap) "D" Odmain)

Frequently the circle will be drawn at 0,0,0 not the coordinate specified.
Similar irregularity occurs when using values other than 0. for Y and X values.

I'm unable to duplicate the anomaly consistantly.

Using World or User UCS seems to make no difference.

Sometimes even entering something like (List 0. 0. 75) to the center prompt at the command line produces the anomaly ...

Anyone come across anything similar ??

Title: Re: Non planar coordinate weirdness with commands.
Post by: Kerry on October 21, 2010, 08:03:50 PM
I've changed the code to ActiveX which has a cople of advantages

1) No Error
2) faster
3) The circle object is returned , saving an (entlast)
:)

Code: [Select]
(setq circObj (vlax-invoke kglobal:modelspace
                           'addcircle
                           (trans (list 0. 0. Startgap) acucs acworld)
                           (* Odmain 0.5)
              )
)


Code: [Select]
(benchmark '((vlax-invoke
              kglobal:modelspace
              'addcircle
              (trans (list 0. 0. Startgap) acucs acworld)
              (* Odmain 0.5)
             )
             (vl-cmdf "_.Circle" (List 0. 0. Startgap) "D" Odmain)
            )
)
Quote
Benchmarking [M.P. 2005] <rev kdub 2005>.......Elapsed milliseconds for 16 iteration(s)/ relative Timing :

    (VL-CMDF "_.Circle" (LIST 0.0 0.0 ST...).....1454 / 96.9333 <slowest>
    (vlax-invoke KGLOBAL:MODELSPACE (QUO...).......15 / 1.0000 <fastest>


... but doesn't resolve the actual issue.
Title: Re: Non planar coordinate weirdness with commands.
Post by: Kerry on October 24, 2010, 10:08:05 PM
Found it !!

Release 2011 has a NEW variable 3DOSMODE that controls the settings for the 3D object snaps.
Appears that the values are saved in the registry not in the drawing

Definitely a trap !!
One solution is to set to 1 {off} and restore after routine is finished .. similar to the OSMODE.

http://docs.autodesk.com/ACD/2011/ENU/filesACR/WS1a9193826455f5ff-40ceff981229d6a8d2c-73f1.htm

A combination of user Settings and optionally selecting 3D and 2D geometry caused the intermittent problem



Title: Re: Non planar coordinate weirdness with commands.
Post by: alanjt on October 24, 2010, 10:31:13 PM
Would this have solved it?
Code: [Select]
(vl-cmdf "_.Circle" "_non" (List 0. 0. Startgap) "D" Odmain)
Title: Re: Non planar coordinate weirdness with commands.
Post by: Kerry on October 24, 2010, 11:22:59 PM
Would this have solved it?
Code: [Select]
(vl-cmdf "_.Circle" "_non" (List 0. 0. Startgap) "D" Odmain)

Probably this :
Code: [Select]
(vl-cmdf "_.Circle"  "_ZNON" (List 0. 0. Startgap) "D" Odmain)
but I need control for both 2D and 3D snaps ... so really it's _ZNON and _NON together

and, I'm now doing all the geometry , extrusions, booleans, Revolves etc with VLA ActiveX methods 'cause it's faster and doesn't require osmode control.

 :)
Title: Re: Non planar coordinate weirdness with commands.
Post by: alanjt on October 25, 2010, 01:33:55 PM
Would this have solved it?
Code: [Select]
(vl-cmdf "_.Circle" "_non" (List 0. 0. Startgap) "D" Odmain)

Probably this :
Code: [Select]
(vl-cmdf "_.Circle"  "_ZNON" (List 0. 0. Startgap) "D" Odmain)
but I need control for both 2D and 3D snaps ... so really it's _ZNON and _NON together

and, I'm now doing all the geometry , extrusions, booleans, Revolves etc with VLA ActiveX methods 'cause it's faster and doesn't require osmode control.

 :)

Interesting, I didn't know such a snap existed. Granted, as you said, I'd still do it with VLA - much faster and no worry of osnaps.
Title: Re: Non planar coordinate weirdness with commands.
Post by: Kerry on October 25, 2010, 04:11:35 PM
Interesting, I didn't know such a snap existed. Granted, as you said, I'd still do it with VLA - much faster and no worry of osnaps.

Not knowing was my issue as well ... it's new with AC20111 AC2011
:)

[edit: coffee too strong, a few too many 1's in the date ]
Title: Re: Non planar coordinate weirdness with commands.
Post by: alanjt on October 25, 2010, 04:15:34 PM
Interesting, I didn't know such a snap existed. Granted, as you said, I'd still do it with VLA - much faster and no worry of osnaps.

Not knowing was my issue as well ... it's new with AC20111 :)
That explains why it doesn't work in v2009.