Jump to content

Q. how enter number while click second point?


Parc

Recommended Posts

Below is a lisp that copies as far as you remember.

What do I do if I want to add the function to enter a number to apply a distance as far as the multiple is applied before I assign a second point to this lisp?
 
see the red point
 
 
(defun c:` (/ CAD us1 pt1 pt2)
(setvar "cmdecho" 0)
(setq us1 (getvar "USERS3")) 
(setq pt1 (getpoint "\nfirst point"))
(setq pt2 (getpoint pt1 "\nsecond point"))
(setq CAD (distance pt1 pt2))
(COMMAND "SETVAR""USERS3"CAD)
(setvar "cmdecho" 1)
(princ))












(defun c:fg (/ di di2 pt1 pt2 ang1 c do do2 do3 S_obj oosmode orth)




(defun *error* (msg)
  (princ "error:")
  (princ msg)
  (setvar "osmode" oosmode)
  (setvar "orthomode" orth)
  (princ)
)

(setvar "cmdecho" 0)
(setq oosmode (getvar "OSMODE"))
(setvar "osmode" 0)
(setq orth (getvar "orthomode"))
(setvar "orthomode" 0)
(setq di (getvar "USERS3"))
(setq S_obj (ssget))
(setq pt1 (getpoint "\nPick the base point "))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(progn
            (setq gr (grread t 15 0) code (car gr) value (cadr gr))
            (cond
                (   (= 5 code) (redraw)
                    
                    (PTE:grCoord (setq pt1(PTE:osP value)) 0.2 1 68)
                    
                t)
                (t)
            )
    )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(setq pt2 (getpoint pt1 "\ndirection"))    ;;; <<<<<<<<<<<<<<<<<<<<<<<<<<<<< add function point 
(setq ang1 (angle pt1 pt2))
(setq do (rtd ang1))
(cond
((or (> do 340.0) (>= 20.0 do)) (setq do2 0.0) (setq do3 (rtos do2 2 0)) (setq c (strcat "@" di ",0")))  ;(setq c (strcat "@" di "<" do3))) ;((or (> do 340.0) (> 20.0 do)) (setq do2 0.0) (setq do2 (rem (+ do2 0) 360)) (setq do3 (rtos do2 2 0)) (setq c (strcat "@" di ",0")))  ;(setq c (strcat "@" di "<" do3)))
((>= 110.0 do 70.0) (setq do2 90.0) (setq do2 (rem (+ do2 0) 360)) (setq do3 (rtos do2 2 0)) (setq c (strcat "@0," di)))
((>= 200.0 do 160.0) (setq do2 180.0) (setq do2 (rem (+ do2 0) 360)) (setq do3 (rtos do2 2 0)) (setq c (strcat "@" "-" di ",0")))
((>= 290.0 do 250.0) (setq do2 270.0) (setq do2 (rem (+ do2 0) 360)) (setq do3 (rtos do2 2 0)) (setq c (strcat "@0," "-" di)))
((> 70.0 do 20.0) (setq c (strcat "@" di "," di)))
((> 160.0 do 110.0) (setq c (strcat "@" "-" di "," di)))
((> 250.0 do 200.0) (setq c (strcat "@" "-" di "," "-" di)))
((> 340.0 do 290.0) (setq c (strcat "@" di "," "-" di)))
)
(setvar "OSMODE" oosmode)
(setvar "orthomode" orth)
(command "copy" S_obj "" "0,0,0" c)
(command "redraw")
(setvar "cmdecho" 1)
(princ)
) 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (defun PTE:osP ( pt / ang p2_ npt _getosmode _grX )

        (defun _getosmode ( os / lst )
            (foreach mode
               '(
                    (0001 . "_end") (0002 . "_mid") (0004 . "_cen")
                    (0008 . "_nod") (0016 . "_qua") (0032 . "_int")
                    (0064 . "_ins") (0128 . "_per") (0256 . "_tan")
                    (0512 . "_nea") (1024 . "_qui") (2048 . "_app")
                    (4096 . "_ext") (8192 . "_par")
                )
                (if (not (zerop (logand (car mode) os)))
                    (setq lst (cons "," (cons (cdr mode) lst)))
                )
            )
            (apply 'strcat (cdr lst))
        )
        
        (defun _grX ( p s c / -s q p )
            (setq -s (- s)
                   q (/ (/ (getvar 'VIEWSIZE) (cadr (getvar 'SCREENSIZE))) 3)
                   p (trans p 1 3)
            )
            (grvecs
                (list c
                    (list -s      -s)  (list s       s)
                    (list -s  (1+ -s)) (list (1- s)  s)
                    (list (1+ -s) -s)  (list s   (1- s))
                    
                    (list -s       s)  (list s      -s)
                    (list -s   (1- s)) (list (1- s) -s)
                    (list (1+ -s)  s)  (list s  (1+ -s))
                )
                (list
                    (list q  0. 0. (car  p))
                    (list 0. q  0. (cadr p))
                    (list 0. 0. q  0.)
                    (list 0. 0. 0. 1.)
                )
            )
            p
        )
        
        (if
            (and
                (zerop (logand 16384 (getvar 'OSMODE)))
                (setq npt (osnap pt (_getosmode (getvar 'OSMODE))))
            )
            (_grX npt 6 20) pt
        )
    )
    
    (defun PTE:grCoord ( pt s c1 c2 / lst size )
        (setq lst 
            (list
                 c1 '( 0.62  0.00  0.0) '( 0.43  0.00 0.0)
                    '(-0.62  0.00  0.0) '(-0.43  0.00 0.0) 
                    '(-0.44 -0.44  0.0) '(-0.30 -0.30 0.0) 
                    '( 0.0  -0.63  0.0) '( 0.00 -0.42 0.0) 
                    '( 0.44 -0.44  0.0) '( 0.30 -0.30 0.0)
                    '( 0.0   0.63  0.0) '( 0.00  0.42 0.0) 
                    '(-0.44  0.44  0.0) '(-0.30  0.30 0.0) 
                    '( 0.44  0.44  0.0) '( 0.30  0.30 0.0) 
                 c2 '( 0.49  0.08  0.0) '( 0.57  0.10 0.0) 
                    '( 0.47  0.17  0.0) '( 0.55  0.20 0.0) 
                    '(-0.47  0.17  0.0) '(-0.55  0.20 0.0) 
                    '(-0.49  0.09  0.0) '(-0.57  0.10 0.0) 
                    '(-0.49 -0.08  0.0) '(-0.57 -0.10 0.0) 
                    '(-0.46 -0.17  0.0) '(-0.55 -0.20 0.0) 
                    '(-0.43 -0.25  0.0) '(-0.50 -0.29 0.0) 
                    '(-0.38 -0.32  0.0) '(-0.44 -0.37 0.0) 
                    '(-0.32 -0.38  0.0) '(-0.37 -0.45 0.0) 
                    '(-0.25 -0.43  0.0) '(-0.29 -0.50 0.0) 
                    '(-0.17 -0.47  0.0) '(-0.20 -0.55 0.0) 
                    '(-0.09 -0.49  0.0) '(-0.10 -0.57 0.0) 
                    '( 0.09 -0.49  0.0) '( 0.10 -0.57 0.0) 
                    '( 0.17 -0.47  0.0) '( 0.20 -0.55 0.0) 
                    '( 0.25 -0.43  0.0) '( 0.29 -0.50 0.0) 
                    '( 0.32 -0.38  0.0) '( 0.37 -0.45 0.0) 
                    '( 0.38 -0.32  0.0) '( 0.44 -0.37 0.0) 
                    '( 0.43 -0.25  0.0) '( 0.50 -0.29 0.0) 
                    '(-0.38  0.32  0.0) '(-0.44  0.37 0.0) 
                    '( 0.38  0.32  0.0) '( 0.44  0.37 0.0) 
                    '( 0.32  0.38  0.0) '( 0.37  0.44 0.0) 
                    '( 0.25  0.43  0.0) '( 0.29  0.50 0.0) 
                    '( 0.17  0.46  0.0) '( 0.20  0.55 0.0) 
                    '( 0.09  0.49  0.0) '( 0.10  0.57 0.0) 
                    '(-0.09  0.49  0.0) '(-0.10  0.57 0.0) 
                    '(-0.17  0.46  0.0) '(-0.20  0.55 0.0) 
                    '(-0.25  0.43  0.0) '(-0.29  0.50 0.0) 
                    '(-0.32  0.38  0.0) '(-0.37  0.45 0.0)
                    '(-0.43  0.25  0.0) '(-0.50  0.29 0.0) 
                    '( 0.43  0.25  0.0) '( 0.50  0.29 0.0) 
                    '( 0.49 -0.08  0.0) '( 0.57 -0.10 0.0) 
                    '( 0.46 -0.17  0.0) '( 0.55 -0.20 0.0) 
            )
        )
        
        (setq size (/ (* (getvar 'VIEWSIZE) s) 1.5))
        
        (grvecs lst
            (list
                (list size 0.0 0.0 (car pt))
                (list 0.0 size 0.0 (cadr pt))
                (list 0.0 0.0 1.0 0.0)
                (list 0.0 0.0 0.0 1.0)
            )
        )
    )

 

[Edit] fg.lsp
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...