Jump to content

Recommended Posts

Posted

This code draws walls with central lines and assigns layers according to the thickness of the wall.

 

I am sure that some of the Gurus can help me improving it as follows:

 

· Get rid of the nasty “; error: bad argument type: 2D/3D point: nil” message when enter the last point

· Having the wall lines filleted when the end point of the last wall is the first point of the first wall (walls closing to form a room).

· Having the wall lines (not the center line) filleted when there are T or X intersections.

· Cleaning the code, to have a better solution.

 

Thanks in advance and my apologies for the poor way of writing codes.

Posted

Dumb of me, here is the code:

 

 

(defun c:walls (/ f1 pnt4 f2 c d e pnt1 pnt3 pnt2 pnt5 pnt6 ang lac laca ee f11 f21)

(setvar "osmode" 0)

(command "fillet" "r" 0)

(setq f1 nil)

(setq pnt4 nil)

(setq f2 nil)

(setq c 0)

 

;;;;;-------------------------------------------------------

(if (not *WID) (setq *WID 0.15))

(princ "\nENTER WALLS WIDTH:

(PRINC *WID)

(SETQ WID (GETDIST ">: " ))

(IF (NOT WID) (SETQ WID *WID) (SETQ *WID WID))

 

(SETQ MWID ( / WID 2))

;;;;;;;----------------------------------------------------

(SETQ EE ( * WID 100))

(SETQ EE (RTOS EE 2 0))

(setq Lac (strcat "WALLS-BLINE-" EE))

;;;;;;-----------------------------------------------------

 

(setq e 3)

(setq pnt1 (getpoint "\nFIRST POINT OF WALL "))

 

(while e

(if (/= pnt3 nil) (setq f1 pnt3))

(if (> c 1) (setq f1 (polar pnt3 aNG mWID)))

 

(if (/= pnt3 nil) (setq f11 pnt5))

 

(if (> c 1) (setq f11 (polar pnt5 aNG mWID)))

 

 

(setq pnt2 (getpoint "\nNEXT POINT " pnt1))

(setq c (+ c 1))

(setq aNG (angle pnt1 pnt2))

(setq pnt3 (polar pnt1 (- aNG (dtr 90)) MWID))

(setq pnt4 (polar pnt2 (- aNG (dtr 90)) MWID))

(setq pnt5 (polar pnt1 (+ aNG (dtr 90)) MWID))

(setq pnt6 (polar pnt2 (+ aNG (dtr 90)) MWID))

(COMMAND "LAYER" "MAKE" LAC "COLOR" "6" "" "LTYPE" "CENTER" "" "")

 

(command "line" pnt1 pnt2 "")

 

(setq LacA (strcat "WALLS-" EE))

 

(IF (

(COMMAND "LAYER" "MAKE" Laca "COLOR" 2 "" "ltype" "continuous" "" "")

(COMMAND "LAYER" "MAKE" Laca "COLOR" 4 "" "ltype" "continuous" "" ""))

 

(command "line" pnt3 pnt4 "")

(command "line" pnt5 pnt6 "")

 

(setq f2 (polar pnt2 (- aNG (dtr 90)) mWID))

(setq f21 (polar pnt2 (+ aNG (dtr 90)) mWID))

 

(setq pnt1 pnt2)

(if (/= f1 nil) (command "fillet" f1 f2))

 

(if (/= f11 nil) (command "fillet" f11 f21))

(COMMAND "LAYER" "SET" "0" "")

)

(princ)

)

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