Author Topic: SSGET - 2 lines different starting point  (Read 1869 times)

0 Members and 1 Guest are viewing this topic.

debgun

  • Guest
SSGET - 2 lines different starting point
« on: March 04, 2010, 02:42:24 PM »
I'm trying to select the two lines that I've created.  I'm trying to select them based on their starting points, but I'm not having much luck.
Code: [Select]
(defun AddLines ()
  (setq adoc (vla-get-activedocument (vlax-get-acad-object))
acsp (if (zerop (vla-get-activespace adoc))
(if (=(vla-get-mspace adoc) :vlax-true)
  (vla-get-modelspace adoc)
  (vla-get-paperspace adoc)
)
(vla-get-modelspace adoc))
  )
  (vla-addline acsp ;add li line to relay output module
    (vlax-3d-point (list 2.96 9 0))
    (vlax-3d-point (list 2 9 0))
  ) ;vla-addline
  (vla-addline acsp ;add out line to relay output module
    (vlax-3d-point (list 5.04 8.8 0))
    (vlax-3d-point (list 6 8.8 0))
  ) ;vla-addline
  (command ".Regen")
  (setq ss (ssget "X" '((0 . "LINE")
(-4 . "<OR") (10 2.96 9.0 0.0) (10 5.04 8.8 0.0) (-4 . "OR>"))
  )
  ) ;setq
  (setq en (ssname ss 0))
    (setq obj (vlax-ename->vla-object en)
  numrows 16
  numcol 1
  numlevels 1
  rowspace -0.4
  colspace 0
  distbetlevels 0
     ) ;setq
    (setq arrobj (vla-arrayrectangular obj numrows numcol numlevels rowspace colspace distbetlevels)
  objlst (vlax-safearray->list (vlax-variant-value arrobj))
    ) ;setq
  (princ)
 ) ;defun

Lee Mac

  • Seagull
  • Posts: 12922
  • London, England
Re: SSGET - 2 lines different starting point
« Reply #1 on: March 04, 2010, 02:49:25 PM »
Deb,

vla-AddLine will return the Line Object that was created (if successful), so no need to collect them up  :-)

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: SSGET - 2 lines different starting point
« Reply #2 on: March 04, 2010, 02:50:39 PM »
Why not just setq (vla-addline?

Edit: Sneaked it in under me Lee.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: SSGET - 2 lines different starting point
« Reply #3 on: March 04, 2010, 02:53:07 PM »
BTW, Debgun, you don't have to call Regen with the command.
Code: [Select]
(vla-Regen adoc acActiveViewport)
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

debgun

  • Guest
Re: SSGET - 2 lines different starting point
« Reply #4 on: March 04, 2010, 03:08:39 PM »
WOW!  Thanks, guys!  I seem to make a anthill into a molehill all the time.

Lee Mac

  • Seagull
  • Posts: 12922
  • London, England
Re: SSGET - 2 lines different starting point
« Reply #5 on: March 04, 2010, 03:10:51 PM »
WOW!  Thanks, guys!  I seem to make a anthill into a molehill all the time.

No worries Deb, we've all been there  :-)