Jump to content

Recommended Posts

Posted

Dear all,

I'm seeking help in this one also. I'm looking for a routine that will divide an area to selected sub areas and drawing the boundaries of new areas inside the parent area.

thanks in advance

Posted

How does it draw the boundary though? It could draw long skinny shapes or intricate twirly shapes or simple rectangles etc...

Posted

Thanks for your interest. I attached a dwg file to what I am thinking of. I just want to get a rectangle inside the area, which represents the sub area.

sample.dwg

Posted

Just a quick shot on this way with no error checking

 
(defun C:A2S(/ ang1 ang2 len osm p1 p2 p3 p4 wid)
    (command "_undo" "_be")
 (setq osm (getvar "osmode"))
  (setvar "cmdecho" 0)
(if
 (and
      (setq p1 (getpoint "\nLower  Left corner point: "))
   (setq p3 (getpoint p1 "\nUpper  Right corner point: "))
 (setq p2 (getpoint p3 "\nLower  Right corner point: ")))
 (progn
 (setq ang1 (angle p2 p1) len (distance p1 p2))
 (setq p2 (polar p2 ang1 (/ len 2)))  
 (setq p4 (polar p3 ang1 len))
 (setq ang2 (angle p1 p4) wid  (distance p1 p4))
 (setq p3 (polar p2 ang2 wid))
 (command "_pline"  "_non" p1  "_non"p2  "_non"p3  "_non"p4 "_CL")
 (command "_copy" (entlast) "" "_non"p1 "_non"p2)
)
 )
 (setvar "osmode" osm)
 (command "_undo" "_e")
 (princ)
 )

  • Like 1
Posted

Thank you fixo for your kind quick reply it is great but can i decide how many splits i can get instead of two!

Posted

Well, try this one instead

 
(defun C:A2S(/ ang1 ang2 len osm p1 p2 p3 p4 wid);;OK
   (setq *num* 2)
 (command "_undo" "_be")
 (setq osm (getvar "osmode"))
  (setvar "cmdecho" 0)
(if
 (and
      (setq p1 (getpoint "\nLower  Left corner point: "))
   (setq p3 (getpoint p1 "\nUpper  Right corner point: "))
 (setq p2 (getpoint p3 "\nLower  Right corner point: "))
   (setq num (cond
         ((getint (strcat"\nSpecify number of subareas (Hit to accept) <"(itoa *num*)">: ")))
         (num)))
         )
 (progn
   (setq *num* num)
 (setq ang1 (angle p1 p2)
ang2 (angle p2 p3)
len (distance p1 p2)
wid  (distance p2 p3)
)
 (setq p2 (polar p1 ang1 (/ len num)))  ;;number of divisions were added
 (setq p4 (polar p1 ang2 wid))
 (setq p3 (polar p2 ang2 wid))
 (command "_pline"  "_non" p1  "_non"p2  "_non"p3  "_non"p4 "_CL")

 (repeat (- num 1)(command "_copy" (entlast) "" "_non" p1 "_non" p2)
   (setq p1 p2
  p2 (polar p1 ang1 (/ len num))))
)
 )
 (setvar "osmode" osm)
 (command "._undo" "_e")
 (princ)
 )

  • Like 1
  • 4 months later...
Posted

It takes only three points.. can u modify to take it any no. of points we like?????

Posted

Sorry, I can't, too difficult for my dim brain

:)

  • 2 years later...
Posted
Dear all,

I'm seeking help in this one also. I'm looking for a routine that will divide an area to selected sub areas and drawing the boundaries of new areas inside the parent area.

thanks in advance

 

Probably this

  • 8 years later...
Posted
On 2/11/2013 at 5:11 PM, fixo said:

Juste un coup rapide sur cette façon sans vérification d’erreur

 

 
(defun C:A2S(/ ang1 ang2 len osm p1 p2 p3 p4 wid)
    (command "_undo" "_be")
 (setq osm (getvar "osmode"))
  (setvar "cmdecho" 0)
(if
 (and
      (setq p1 (getpoint "\nLower  Left corner point: "))
   (setq p3 (getpoint p1 "\nUpper  Right corner point: "))
 (setq p2 (getpoint p3 "\nLower  Right corner point: ")))
 (progn
 (setq ang1 (angle p2 p1) len (distance p1 p2))
 (setq p2 (polar p2 ang1 (/ len 2)))  
 (setq p4 (polar p3 ang1 len))
 (setq ang2 (angle p1 p4) wid  (distance p1 p4))
 (setq p3 (polar p2 ang2 wid))
 (command "_pline"  "_non" p1  "_non"p2  "_non"p3  "_non"p4 "_CL")
 (command "_copy" (entlast) "" "_non"p1 "_non"p2)
)
 )
 (setvar "osmode" osm)
 (command "_undo" "_e")
 (princ)
 )
 

 

VERRY GOOD THANKS

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