Author Topic: How to use transparent command "'zoom" or "'pan" in command "Pline"  (Read 5829 times)

0 Members and 1 Guest are viewing this topic.

qjchen

  • Bull Frog
  • Posts: 285
  • Best wishes to all
How to use transparent command "'zoom" in "Pline"

I want to do this function, when I draw a pline upon some points, it automatically pan .

I search this in google group, and get this two.
http://groups.google.com/group/autodesk.autocad.customization/browse_thread/thread/447fa68e623abf63/06cac073465d34ac?lnk=gst&q=%27zoom+pline&rnum=3#06cac073465d34ac
http://groups.google.com/group/autodesk.autocad.customization/browse_thread/thread/2c7be821154011fb/afbf2a342aa554d9?lnk=gst&q=%27zoom+pline&rnum=8#afbf2a342aa554d9

This one
Code: [Select]
;;;http://groups.google.com/group/autodesk.autocad.customization/browse_thread/thread/2c7be821154011fb/cb9427d8ad609042?lnk=gst&q=pline+%27zoom&rnum=17#cb9427d8ad609042
;;;  Jason Wilder     

(defun c:pll( / p1 p2 pset lset)
  (setq lset (ssadd))
  (setq p1 (getpoint "\nStart point: "))
  (setq pset (list p1))
  (setq p2 (getpoint p1 "\nNext point: "))
  (setq pset (cons p2 pset))
  (command "_line" p1 p2 "")
  (ssadd (entlast) lset)
  (command "_pan" p2 p1)
  (while (/= p2 NIL)
    (setq p1 p2)
    (setq p2 (getpoint p1 "\nNext Point: "))
    (if p2 (setq pset (cons p2 pset)))
    (command "_line" p1 p2 "")
    (ssadd (entlast) lset)
    (command "_pan" p2 p1)
  );while
  (command ".erase" lset "")
  (command ".pline")
  (foreach pt pset
    (command pt)
  )
  (command "")
)

The effect is what I need.

but it can't draw arc or set width of pline.

How can I use 'zoom or 'pan in "pline" or "spline" command directly.

That means, not just get point list and then finally use foreach to construct the pline.

Thank you very much.
http://qjchen.mjtd.com
My blog http://chenqj.blogspot.com (Chinese, can be translate into English)

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: How to use transparent command "'zoom" or "'pan" in command "Pline"
« Reply #1 on: July 14, 2007, 11:09:47 AM »
I don't know that one needs to use any 'code' to perform transparent pans or zooms during the PLINE command. In normal use on simply depresses the Middle Mouse button to Pan, or rolls the wheal In/Out to zoom. Optionally one can tip 'p, or 'z during the PLINE command to call the transparent pan/zoom function one needs.
Be your Best


Michael Farrell
http://primeservicesglobal.com/

rainier

  • Guest
Re: How to use transparent command "'zoom" or "'pan" in command "Pline"
« Reply #2 on: July 15, 2007, 07:24:37 PM »
yuanqiu, try this... 'pan or 'zoom

hope it helps..

T.Willey

  • Needs a day job
  • Posts: 5251
Re: How to use transparent command "'zoom" or "'pan" in command "Pline"
« Reply #3 on: July 16, 2007, 11:42:19 AM »
Can you just use the pline command within your code then?
Code: [Select]
(command "_.pline")
(while (> (getvar "cmdactive") 0)
 (command pause)
)
Make sure the 'cmdecho' variable is set to 1 so you can see the prompts for the pline command.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: How to use transparent command "'zoom" or "'pan" in command "Pline"
« Reply #4 on: July 16, 2007, 12:26:37 PM »
Now I am going to open my mouth and mostly likely a bunch of noise is going to come out.

Is there not a function that will center the screen editor about a user selected point. 
Could the screen follow the points that are entered by the user for the pline?

I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: How to use transparent command "'zoom" or "'pan" in command "Pline"
« Reply #5 on: July 16, 2007, 01:26:10 PM »
Code: [Select]
(defun c:pll (/ p1 p2 plst)
  (defun grlst (lst / glst)
    (mapcar '(lambda (x)
               (setq glst
                      (cond
                        ((null glst) (list x))
                        ((> (length glst) 1) (append glst (list (last glst) x)))
                        (t (list (car glst) x))
                      )
               )
             )
            lst
    )
    glst
  )
  (setq p1 (getpoint "\nStart point: "))
  (command "_zoom" "_C" "_non" p1 "")
  (while (setq p2 (getpoint p1 "\nNext point: "))
    (command "-pan" "_non" p2 "_non" p1)
    (setq plst (if plst (cons p2 plst) (list p2 p1))
          p1   p2
    )
    (grvecs (cons 256 (grlst plst)))
  )
  (command ".pline")
  (foreach pt plst (command "_non" pt))
  (command "")
  (redraw)
  (princ)
)

<edit: added zoom>
« Last Edit: July 16, 2007, 01:47:40 PM by CAB »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

qjchen

  • Bull Frog
  • Posts: 285
  • Best wishes to all
Re: How to use transparent command "'zoom" or "'pan" in command "Pline"
« Reply #6 on: July 17, 2007, 08:58:34 AM »
Thank you all:)

Sometimes when I draw line along many points, I have to pan again and again, so I want to write this code that it automatic pan each time I draw a point.

To T.Willey
Thank you

CAB has ever write a code for me about a pline arrow, Yours two code is very similar.
Code: [Select]
(defun c:test ()
  (vl-load-com)        ;  no error checking
  (prompt "\nDraw your pline.")
  (command "PLINE")
  (while (> (getvar "CMDACTIVE") 0)
    (command pause)
  )
  (setq ent (entlast))
  (setq ArrowLength 5
ArrowWidth 2
  )
  (setq ArrowBasePt (vlax-curve-getPointAtDist ent ArrowLength))
  (command "_pedit" ent "_e" "_i" "_non" ArrowBasePt "_x" "_e" "_w" "0"
   ArrowWidth "_x" "" ""
  )
  (princ)
)

so I want to add just code inside it
Code: [Select]
(while (> (getvar "CMDACTIVE") 0)
    (command pause)
    (command "'pan" p1 p2)
  )

but sure the code cant run.

To CAB
Thank you, the code run well. but nows code cant draw arc pline or set width because it use "foreach" to construct nor the normal pline command, can the transparent command be run in "pline" command?
http://qjchen.mjtd.com
My blog http://chenqj.blogspot.com (Chinese, can be translate into English)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: How to use transparent command "'zoom" or "'pan" in command "Pline"
« Reply #7 on: July 17, 2007, 09:10:02 AM »
It can be done, but I don't have the time or desire at the moment.
I think mjfarrell said it best.
I don't know that one needs to use any 'code' to perform transparent pans or zooms during the PLINE command. In normal use on simply depresses the Middle Mouse button to Pan, or rolls the wheal In/Out to zoom. Optionally one can tip 'p, or 'z during the PLINE command to call the transparent pan/zoom function one needs.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Crank

  • Water Moccasin
  • Posts: 1503
Re: How to use transparent command "'zoom" or "'pan" in command "Pline"
« Reply #8 on: July 20, 2007, 09:54:41 AM »

so I want to add just code inside it
Code: [Select]
(while (> (getvar "CMDACTIVE") 0)
    (command pause)
    (command "'pan" p1 p2)
  )

but sure the code cant run.

Haven't tryed this, but can't you use 'zoom center?
Code: [Select]
(while (> (getvar "CMDACTIVE") 0)
    (command pause)
    (command "'zoom" "c" (getvar "LASTPOINT") "")
  )
« Last Edit: July 20, 2007, 02:05:38 PM by Maverick® »
Vault Professional 2023     +     AEC Collection

qjchen

  • Bull Frog
  • Posts: 285
  • Best wishes to all
Re: How to use transparent command "'zoom" or "'pan" in command "Pline"
« Reply #9 on: July 22, 2007, 08:16:23 AM »
Thank you, Crank, but it seems not work:)

just like this, is not working

Code: [Select]
(defun c:test ()
  (vl-load-com)        ;  no error checking
  (prompt "\nDraw your pline.")
  (command "PLINE")
  (while (> (getvar "CMDACTIVE") 0)
    (command pause)
    (command "'zoom" "c" (getvar "LASTPOINT") "")
  )
  (setq ent (entlast))
  (setq ArrowLength 5
ArrowWidth 2
  )
  (setq ArrowBasePt (vlax-curve-getPointAtDist ent ArrowLength))
  (command "_pedit" ent "_e" "_i" "_non" ArrowBasePt "_x" "_e" "_w" "0"
   ArrowWidth "_x" "" ""
  )
  (princ)
)
http://qjchen.mjtd.com
My blog http://chenqj.blogspot.com (Chinese, can be translate into English)