Jump to content

Recommended Posts

Posted

Hi,

 

Have just made my very first LISP program. Thanks to Lee Mac I got the PLine to block to work. But know I need some help...

 

In addition to what's allready included (Yes I know, it can be done better) I want to:

1. Include the blockname as text inside the block

2. Add the lengths of the offsetlines and it's diagonal (A-C) to attributes.

 

Is this easily done?

 

Thanks,

Magnus

 

 
(defun c:glas ()
 
(setq A (getpoint "Pick point A: ")) 
(setq B (getpoint "Pick point B: "))
(setq C (getpoint "Pick point C: "))
(setq D (getpoint "Pick point D: "))

;(command "text" A 100 0 A)
;(command "text" B 100 0 B)
;(command "text" C 100 0 C)
;(command "text" D 100 0 D)
  (setq E (command "pline" A B C D))
(command "close")

;(setq rad (angle A B))

(command "rectangle" A C)
 
(command "offset" 10 (entlast) (getpoint "Pick point: "))
  (command "exit")
 
 (cond (  (not (setq ss (ssget '((0 . "~VIEWPORT"))))))
       (  (while
            (progn
              (setq bNme (getstring t "\nSpecify Block Name: "))
              (cond (  (not (snvalid bNme))
                       (princ "\n** Invalid Block Name **"))
                    (  (tblsearch "BLOCK" bNme)
                       (princ "\n** Block Already Exists **"))))))
       (  (not (setq i -1 pt (getpoint "\nSpecify Base Point: "))))
       (t (entmake (list (cons 0 "BLOCK") (cons 10 pt) (cons 2 bNme) (cons 70 0)))
          (while (setq ent (ssname ss (setq i (1+ i))))             
            (entmake (entget ent))
            
            (and (= 1 (cdr (assoc 66 (entget (setq sub ent)))))
                 (while (not (eq "SEQEND" (cdr (assoc 0 (entget (setq sub (entnext sub)))))))
                   (entmake (entget sub)))
                 (entmake (entget sub)))
            
            (entdel ent))
          (entmake (list (cons 0 "ENDBLK") (cons 8 "0")))
          (entmake (list (cons 0 "INSERT") (cons 2 bNme) (cons 10 pt)))))
 (princ))
)
(princ)

Posted
Magnus,

 

It is common coding etiquette to give credit to the author of the code that you have quite clearly stolen.

 

We don't take kindly to people who don't take kindly.

 

Me%20police%20pic%201986.JPG

Posted
Magnus,

 

It is common coding etiquette to give credit to the author of the code that you have quite clearly stolen.

 

Ok, I'm so very sorry. I thought "Thanks to Lee Mac..." was a kind of cred, but apparently not enough. :oops: And I didn't know it was possible to steal something, posted in a forum, for everyone to see, without any leagal right texts...but apparently it is. So very sorry!

Posted
Ok, I'm so very sorry. I thought "Thanks to Lee Mac..." was a kind of cred, but apparently not enough. :oops: And I didn't know it was possible to steal something, posted in a forum, for everyone to see, without any leagal right texts...but apparently it is. So very sorry!

Is it not still his code. He has creator rights and you should denote that.

 

Code posted in forums still belongs to the original author, he has just given usage and editing rights. However, any and all credit to coding from original author must remain intact and/or given. If you take a piece of posted code and modify it, keep all original author's information intact AND label where you made modifications.

 

I think I covered everything.

Posted
Pretty much - more info here.

Oh yeah, forgot to link that.

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