Author Topic: I want/need a program  (Read 9288 times)

0 Members and 1 Guest are viewing this topic.

Mark

  • Custom Title
  • Seagull
  • Posts: 28753
I want/need a program
« on: September 26, 2003, 09:27:52 AM »
It needs to do this:

prompt user for 2 points;
draw line between points
start extend command
use line to extend too
prompt user for "Select object to extend"
all I'm going to extend is a line nothing fancy.
TheSwamp.org  (serving the CAD community since 2003)

JohnK

  • Administrator
  • Seagull
  • Posts: 10605
I want/need a program
« Reply #1 on: September 26, 2003, 09:49:10 AM »
Like this?
Code: [Select]

(defun mst-extend ()
  (vl-cmdf "line" (getpoint (setq x (getpoint))) x "")
  (vl-cmdf "extend" (entsel))
  )
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Mark

  • Custom Title
  • Seagull
  • Posts: 28753
I want/need a program
« Reply #2 on: September 26, 2003, 09:55:12 AM »
close.

but I don't want to have to select the line i just created, just the line to extend.
TheSwamp.org  (serving the CAD community since 2003)

JohnK

  • Administrator
  • Seagull
  • Posts: 10605
I want/need a program
« Reply #3 on: September 26, 2003, 10:28:13 AM »
Like this?
Code: [Select]
(defun mst-extend2 ()
  (setq line (vla-addline
               (vla-get-ModelSpace
                 (vla-get-ActiveDocument
                   (vlax-get-object "AutoCAD.Application")))
               (vlax-3d-point (getpoint (setq x (getpoint))))
               (vlax-3d-point x)))
  (vl-cmdf "extend" (vlax-vla-object->ename line))
  (if (not (vlax-object-released-p line))
    (vlax-release-object line)
   )
 )


BTW, My "junk" file is getting WAY to big. (I couldnt find anything i was looking for. :P )

EDIT: Released the line object.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Mark

  • Custom Title
  • Seagull
  • Posts: 28753
I want/need a program
« Reply #4 on: September 26, 2003, 10:37:33 AM »
Almost!! but close enough. :D
mine, based on yours.
Code: [Select]
(defun mst-extend2 (/ line)
  (setq line (vla-addline
      (vla-get-ModelSpace
(vla-get-ActiveDocument
  (vlax-get-object "AutoCAD.Application")
  )
)
      (vlax-3d-point
(getpoint "\nSelect 2nd Point: "
  (setq x (getpoint "\nSelect 1st Point: "))
  )
)
      (vlax-3d-point x)
      )
)
  (if line
    (progn (vl-cmdf "extend" (vlax-vla-object->ename line) "")
  (vlax-release-object line)
  )
    )
  (princ)
  )


notice the "" in the cmdf statement.
TheSwamp.org  (serving the CAD community since 2003)

JohnK

  • Administrator
  • Seagull
  • Posts: 10605
I want/need a program
« Reply #5 on: September 26, 2003, 10:45:23 AM »
dosent work.  :?  
Wait, you wanted to extend the line you just drew? (that doesnet make anysense!) Ohhh i get what your after ...i think. You want to extend aother line to this line you just drew. (Now that would change things a bit.)  Sorry, i misunderstood ya.

Glad it works.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Mark

  • Custom Title
  • Seagull
  • Posts: 28753
I want/need a program
« Reply #6 on: September 26, 2003, 10:52:17 AM »
Quote
Glad it works

me too!!
TheSwamp.org  (serving the CAD community since 2003)