Author Topic: 2 intersecting circles: vlax-invoke 'IntersectWith returns nil in Bricscad  (Read 2918 times)

0 Members and 1 Guest are viewing this topic.

Peter Guappa

  • Guest
(defun C:test1 ()
  (entmake (list (cons 0 "CIRCLE") (cons 8 "0") (cons 10 (list 91723.9085 166321.0746)) (cons 40 11.8100)))
  (setq obj1 (vlax-ename->vla-object (entlast)))
  (entmake (list (cons 0 "CIRCLE") (cons 8 "0") (cons 10 (list 91732.6796 166328.9847)) (cons 40 0.00160)))
  (setq obj2 (vlax-ename->vla-object (entlast)))
  (setq lst (vlax-invoke obj1 'IntersectWith obj2 acExtendNone))
  lst
  );defun

When I load and run this  in Bricscad, it returns nil.

In AutoCad it returns the list with intersection points.

How can I solve this?
Thx


hmspe

  • Bull Frog
  • Posts: 362
Re: 2 intersecting circles: vlax-invoke 'IntersectWith returns nil in Bricscad
« Reply #1 on: November 04, 2011, 09:47:00 PM »
I suspect that Bricscad doesn't like the small radius of the second circle.  I've seen issues in Bricscad with ssget calls.  I've changed my standard routine to the following.  You may be seeing something similar.
Code: [Select]
 
(defun ssat (pnt dist)
  (if (vl-string-search "BRICSCAD" (strcase (getvar "acadver")))
    (if (< dist 0.001) (setq dist 0.001))
  )
  (ssget "c"
    (list (- (car pnt) dist) (- (cadr pnt) dist))
    (list (+ (car pnt) dist) (+ (cadr pnt) dist))
  )
)
"Science is the belief in the ignorance of experts." - Richard Feynman

Peter Guappa

  • Guest
Re: 2 intersecting circles: vlax-invoke 'IntersectWith returns nil in Bricscad
« Reply #2 on: November 04, 2011, 10:26:10 PM »
When I call the 2 circles and try again at commandline it still returns nil

: test1
nil
: !obj1
#<VLA-OBJECT IAcadCircle 03f22378>
: !obj2
#<VLA-OBJECT IAcadCircle 03f22978>
: (setq lst (vlax-invoke obj1 'IntersectWith obj2 acExtendNone))
nil


But when I select the circles with entsel, it does work...... strange!!! (and the vla-objects are the same as above)

: (setq obj1a (vlax-ename->vla-object (car (entsel))))
Select entity: #<VLA-OBJECT IAcadCircle 03f22978>
: (setq obj2a (vlax-ename->vla-object (car (entsel))))
Select entity: #<VLA-OBJECT IAcadCircle 03f22378>
: (setq lst (vlax-invoke obj1a 'IntersectWith obj2a acExtendNone))
(91732.7 166329.0 0.0 91732.7 166329.0 0.0)


Am I missing something?
« Last Edit: November 04, 2011, 10:29:49 PM by Peter Guappa »

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: 2 intersecting circles: vlax-invoke 'IntersectWith returns nil in Bricscad
« Reply #3 on: November 05, 2011, 08:17:13 AM »
Shot in the dark, but what does this return?

Code: [Select]
(defun c:test ( / doc spc obj1 obj2 )
    (setq doc  (vla-get-activedocument (vlax-get-acad-object))
          spc  (vlax-get-property doc (if (= 1 (getvar 'CVPORT)) 'paperspace 'modelspace))
          obj1 (vla-addcircle spc (vlax-3D-point (list 91723.9085 166321.0746)) 11.8100)
          obj2 (vla-addcircle spc (vlax-3D-point (list 91732.6796 166328.9847)) 0.00160)
    )
    (vlax-invoke obj1 'intersectwith obj2 acextendnone)   
)
(vl-load-com) (princ)

Peter Guappa

  • Guest
Re: 2 intersecting circles: vlax-invoke 'IntersectWith returns nil in Bricscad
« Reply #4 on: November 05, 2011, 08:34:30 AM »
@ Lee Mac: it also returns nil  :-(

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: 2 intersecting circles: vlax-invoke 'IntersectWith returns nil in Bricscad
« Reply #5 on: November 05, 2011, 08:36:56 AM »
This must be a bug. If you change the order for the IntersectWith function you do get the intersections.
Code: [Select]
(setq lst (vlax-invoke obj2 'IntersectWith obj1 acExtendNone)) ; swap obj1 and obj2

Peter Guappa

  • Guest
Re: 2 intersecting circles: vlax-invoke 'IntersectWith returns nil in Bricscad
« Reply #6 on: November 05, 2011, 08:52:01 AM »
Swapping the objects works !!!
Don't know why I haven't tried this before  :-)
Thx roy_043

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: 2 intersecting circles: vlax-invoke 'IntersectWith returns nil in Bricscad
« Reply #7 on: November 05, 2011, 10:04:55 AM »
Swapping the objects works !!!
Don't know why I haven't tried this before  :-)
Thx roy_043
Code: [Select]
(setq lst (cond ((vlax-invoke obj1 'IntersectWith obj2 acExtendNone))
                ((vlax-invoke obj2 'IntersectWith obj1 acExtendNone))
          )
)

If it doesn't work the first way, it tests the reverse.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: 2 intersecting circles: vlax-invoke 'IntersectWith returns nil in Bricscad
« Reply #8 on: November 06, 2011, 04:24:44 AM »
Don't know why I haven't tried this before  :-)
Actually you have tried this in the test described in your second post: obj1a is obj2 and obj2a is obj1.