Jump to content

Recommended Posts

Posted

I'm looking for a simple lisp that puts a block (name: corner) in all corners of a rectangle. it needs to turn with the box. the block is at 0º in the upper left hand corner. I know there's something out there like this but I couldn't find it.

Posted

I meant to upload a pic

SAMPLE.jpg

Posted

Sounds like someone needs to learn LISP. :wink:

Posted

In the language of pseudocode... :P

 

  • Prompt for Block Selection [selection/getstring ~ check validity (findfile)]

  • Prompt for box Selection (check object validity)

  • Get Vertices of Box (dxf group code 10 - multiple entries)

  • Sort Points by x then y, or vice versa and insert block with correct rotation at each point. (Alternatively, perhaps get First Derivative of curve near vertex to determine rotation.

Posted

Don't forget to check for direction of polygon. :)

 

FRAME.gif

Posted
Haha nice one Alan :thumbsup:

 

You're such a tease lol :P

 

HaHa, thanks. :P

I was looking for Gile's Clockwise routine, but then I remembered I could just use the formula to check the area of a triangle (given 3 points), so I just used that.

Posted

It goes along with the the code you helped me with the first time. When I create this I want the corners to fill in. I'd like them to come in automatically but if I have to select them than that's fine

 

(defun c:COMP1 (/ blockname p1 p2 d d1)
 ;; modified by Reid b.
 (vl-load-com)
 (setq blockname "1compartment")
 (if (and (or (tblsearch "block" blockname)
              (findfile (strcat blockname ".dwg"))
              (alert (strcat blockname " cannot be found!"))
          )
          (setq p1 (getpoint "\nSpecify block insertion point: "))
          (setq d (getdist p1 "\nSpecify box width: "))
          (setq d1 (getdist p1 "\nSpecify box length: "))
     )
   ((lambda (block)
      (foreach x (vlax-invoke block 'GetDynamicBlockProperties)
        (cond ((eq (vla-get-propertyname x) "DISTANCE")
               (vla-put-value
                 x
                 (cond
                   ((>= 0.125 (/ d 0.125)) 0.125)
                   ((< 0.125 (setq num (/ d 0.125))) (* 0.125 (fix num)))
                   (0.125)
                 )
               )
              )
              ((eq (vla-get-propertyname x) "DISTANCE1")
               (vla-put-value
                 x
                 (cond
                   ((>= 0.125 (/ d1 0.125)) 0.125)
                   ((< 0.125 (setq num (/ d1 0.125))) (* 0.125 (fix num)))
                   (0.125)
                 )
               )
              )
        )
      )
      (vl-catch-all-apply (function (lambda () (vla-explode block) (vla-delete block))))
    )
     (vla-insertblock
       (if
         (or (eq acmodelspace
                 (vla-get-activespace
                   (cond (*AcadDoc*)
                         ((setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object))))
                   )
                 )
             )
             (eq :vlax-true (vla-get-mspace *AcadDoc*))
         )
          (vla-get-modelspace *AcadDoc*)
          (vla-get-paperspace *AcadDoc*)
       )
       (vlax-3d-point (trans p1 1 0))
       blockname
       1.
       1.
       1.
       0.
     )
   )
 )
 (princ)
)

 

http://www.cadtutor.net/forum/showthread.php?t=47619

Posted

It's really nice of you to completely remove my name from my code.:roll:

Posted
It's really nice of you to completely remove my name from my code.:roll:

 

I copied this code from http://www.cadtutor.net/forum/showthread.php?t=47619&page=4

 

I thought I selected all but I guess I missed it. Look at comment #38

 

I promise your name is on this code. I've never claimed to know lisp

 

I did clip out

        (angle (trans p1 1 0) (trans p2 1 0)) ;; modified by Reid b.

Posted
I can't believe that... :o

:lol::lol:

Posted

Could you point me to the right thread?

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