Jump to content

Recommended Posts

Posted

I need to Write a lisp routine that has the user pick 2 points (opposite corners) then draws a

polyline through 4 points using the two points specified by the user and the two other corners  I Do not want to use the Rectangle command. After the

polyline has been drawn, change the polyline width to .125 (for all segments).

The lisp file will then create a layer, called `Object' that is green and place the polyline

on that layer.   

Posted

What have you written so far? Post your effort and perhaps we  can assist.

Posted


(defun C:Testing ()                        
    (setq    P1 (getpoint "\nLower-left corner: ")        
        P3 (getcorner P1 "\nUpper-right corner")    
        P2 (list (car P3) (cadr P1))            
        P4 (list (car P1) (cadr P3))            
        P1A (list (+ (car P1) 0.1) (+ (cadr P1) 0.1))    
        P2A (list (- (car P2) 0.1) (+ (cadr P2) 0.1))    
        P3A (list (- (car P3) 0.1) (- (cadr P3) 0.1))    
        P4A (list (+ (car P4) 0.1) (- (cadr P4) 0.1))    
    )                            
    (command "-osnap" "none")
    (command "LINE" P1 P2 P3 P4 "C")            
    (command "LINE" P1A P2A P3A P4A "C")            
)    

Posted

Is this a homework assignment ? 😉 Using the rectang command would be the most direct route.

Posted (edited)
30 minutes ago, ramon said:

It is.

Hahaha .. I admire your honesty. Well hope you can learn from this :) ( you still have to do the layer part )

(defun c:testing (/ p1 plw p2 p3 p4)	; < - Localize variables!!
  (setq	p1 (getpoint "\nLower-left corner: ")
	p3 (getcorner p1 "\nUpper-right corner")
	p2 (list (car p3) (cadr p1))
	p4 (list (car p1) (cadr p3))
;;;	p1a (list (+ (car p1) 0.1) (+ (cadr p1) 0.1))
;;;	p2a (list (- (car p2) 0.1) (+ (cadr p2) 0.1))
;;;	p3a (list (- (car p3) 0.1) (- (cadr p3) 0.1))
;;;	p4a (list (+ (car p4) 0.1) (- (cadr p4) 0.1))
  )
  (command "-osnap" "none")
  (setq plw (setvar 'plinewid 0.125))
  (setvar 'plinewid 0.125)
  (command ".pline" p1 p2 p3 p4 "c")
;;;  (command "LINE" p1 p2 p3 p4 "C")
;;;  (command "LINE" p1a p2a p3a p4a "C")
  (setvar 'plinewid plw)
)

 

Edited by ronjonp
Posted

 thank you  for the the knowledge you have bestowed upon me.

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...