Jump to content

AutoliSP resquest


Madruga_SP

Recommended Posts

Hi friends!

 

if someone can help me i will be thanks!!

:D

 

I need a lisp can calculate area and perimeter. That lisp isn't hard to be found.

But I need one more thing. Insert floor (0.5x0.5) in it. Hatch could be a good way to do that.

I'd like to know How many floors was used and hatch can't be counted, right?

 

Can anyone help me out, please?

 

Thank in advance

TEST.dwg

Link to comment
Share on other sites

There are some ways of using Array to make a pattern of say floor tiles then trim to a pline boundary you can then count up tiles, try Array and Extrim. Your dwg is exactly what I am talking about its the one bit of code I no longer have. I have been meaning to rewrite it again.

 

Looking again. UCS OB this sets the angle for use with Array of your plines make larger than shape use extrim and Cookiecutter.lsp, use Filter select plines gives total, Ucs W all done.

Link to comment
Share on other sites

Thank you for the quick replay BIGAL

 

I'm drawing a square 0.50x0.50, put it the point origin and use copy/array command and extrim command.

 

All my task is using autocad command and It is good by the way.

But I'd like to make it easier, maybe a lisp can help me out.

 

So, My task (file dwg) is attached. If someone is interested, I'll be really glad!

 

Thank in advance

Link to comment
Share on other sites

The lisp I wrote did just that pick pline near corner splat all done unfortunately I do not have it. Just a time thing to redo. Get priorities right going fishing.

Link to comment
Share on other sites

Ok BIGAL, thank you!

 

If someone is interested in my task, I'll be really glad!

 

I really need that code. :(

 

Thank you very much

Link to comment
Share on other sites

I have just wrote this piece of codes to draw boxed in the area that you would specify on screen , try it and let me know .

 

(defun c:test (/ _poly:box w h a b c d x y p1 p2 p3 w1 h1 lft-1 lft-2 p)
 ;;         Tharwat Al Shoufi        ;;
 (if
   (and (setq
          *width*
           (cond ((getdist (strcat "\n Specify Width of box <"
                                   (rtos (cond (*width*)
                                               ((setq *width* 1.0))
                                         )
                                         2
                                         2
                                   )
                                   ">: "
                           )
                  )
                 )
                 (*width*)
           )
        )
        (setq
          *height* (cond
                     ((getdist (strcat "\n Specify Height of box <"
                                       (rtos (cond (*height*)
                                                   ((setq *height* 1.0))
                                             )
                                             2
                                             2
                                       )
                                       ">: "
                               )
                      )
                     )
                     (*height*)
                   )
        )
        (setq a (getpoint "\n Specify base point :"))
        (setq b (getcorner "\n Specify opposite point :" a))
   )
    (progn
      (defun _poly:box (p wid hgt / 1p 2p 3p)
        (entmakex
          (list '(0 . "LWPOLYLINE")
                '(100 . "AcDbEntity")
                '(100 . "AcDbPolyline")
                '(90 . 4)
                '(70 . 1)
                (cons 10 (setq 1p (polar p 0. wid)))
                (cons 10 (setq 2p (polar 1p (* pi 1.5) hgt)))
                (cons 10 (setq 3p (polar 2p pi wid)))
                (cons 10 p)
          )
        )
        (princ)
      )
      (setq c  (list (car a) (cadr b))
            d  (list (car b) (cadr b))
            x  (mapcar 'car (list a b c d))
            y  (mapcar 'cadr (list a b c d))
            p1 (list (apply 'min x) (apply 'max y))
            p2 (list (apply 'max x) (apply 'max y))
            p3 (list (apply 'min x) (apply 'min y))
            w  *width*
            h  *height*
      )
      (if (and (> (setq w1 (distance p1 p2)) w)
               (> (setq h1 (distance p1 p3)) h)
          )
        (progn
          (setq p p1)
          (repeat (fix (/ h1 h))
            (repeat (fix (/ w1 w))
              (_poly:box p1 w h)
              (setq p1 (polar p1 0. w))
            )
            (if (< 0 (setq lft-1 (rem w1 w)))
              (_poly:box p1 lft-1 h)
            )
            (setq p  (polar p (* pi 1.5) h)
                  p1 p
            )
          )
          (if (< 0 (setq lft-2 (rem h1 h)))
            (progn
              (repeat (fix (/ w1 w))
                (_poly:box p1 w lft-2)
                (setq p1 (polar p1 0. w)
                )
              )
              (_poly:box p1 lft-1 lft-2)
            )
          )
        )
      )
    )
 )
 (princ)
)

Link to comment
Share on other sites

Thank you Tharwat!!!

 

The code worked perfect.

 

I need to set the origin (when the box starts) .

But when was a perimeter with irregular form, I couldn't inserted the box all my figure.

 

To rectangle or square worked perfect!

 

Thank you very

I'm really happy with the goal :D

Link to comment
Share on other sites

Hi,

Sorry for my bad english. I couldn't explain clearly my doubts.

if you don't bother I'm attaching other file to explain better.

 

Thank in advance

e.g.dwg

Link to comment
Share on other sites

Hi ,

 

For the irregular forms , it won't work with them and that's why I forced the user to pick two opposite points that shape a rectangle .

But for the origin , that is something will become complicated and over my head now . :( and I may try to work on it later on .

Link to comment
Share on other sites

Tharwat as I said earlier its pretty easy yes you need to pick a start corner to line up the objects from, the way I did it was to isolate the pline object put on temp layer then simply window the pline this sets the bounding area to fill which is bigger than the any shape pline including curves. Next is to use the offset to the pline to trim the boxes that need to be cut, then do some layer stuff and all done, I am sure I used a multiple offset method to erase the trimmed objects on the outside. Its about the only bit of code I dont have.

 

waffle.jpg

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