Jump to content

Insert Block instead of donut in this lisp


Recommended Posts

Posted

Dear All,

I am working with Road layout drawing. In this drawing I am using one lisp to take the coorination point for ducts.

I would like to change lisp according to my use.

In this lisp i want to insert one block object instead of donut.

Herewith i am attached code of this lisp.

Thanks in advance.

 

 
(DEFUN C:TH ()
       (SETQ h (GETDIST " \n Enter HEIGHT OF TEXT : "))
       (setq  x (* 6 h))
       (setq  y (* 12 h))
       (setq  y1 (* 2 h))
       (setq  z (/ h 2))
       (SETQ CRN (GETPOINT "\n Enter Top Left Start corner for table: ")
              angle (getangle "\n Pick Rotation Angle :")
              ang (* angle 57.32484076)
              NO (GETINT " \n Enter start number : ")
              PNT (GETPOINT "\n Pick first coordinate: ")
              CRN1 (POLAR CRN angle x)
              CRN2 (POLAR CRN1 angle y)) 
     (setq p1 (polar crn (+ angle 3.14) h)
            p2 (polar crn1 (+ angle 3.14) h)
            p3 (polar crn2 (+ angle 3.14) h)
            p7 (polar p1 (+ angle 1.57) (* 2 h))
            p8 (polar p2 (+ angle 1.57) (* 2 h))
            p9 (polar p3 (+ angle 1.57) (* 2 h))
            p10 (polar p7 (+ angle 1.57) (* 3 h))
            p11 (polar p8 (+ angle 1.57) (* 3 h))
            p12 (polar p9 (+ angle 1.57) (* 3 h))
            p13 (polar p12 angle  y )
            p14 (polar p9 angle  y )
            Ins1 (polar crn (+ angle 1.57) (* 3 h))
            Ins2 (polar crn1 (+ angle 1.57) (* 3 h))
            Ins3 (polar crn2 (+ angle 1.57) (* 3 h)))
      (command "regenauto" "off")
      (WHILE PNT
      (SETQ EPNT (RTOS (CAR PNT) 2 3)
            NPNT (RTOS (CADR PNT) 2 3)
            pnt1 (polar pnt (+ angle 0.7857142857) (* h 0.85))
            CRN1 (POLAR CRN angle x)
            CRN2 (POLAR CRN1 angle y)) 
      (setq NO1 (RTOS no 2 0))
      (SETQ NO2 (STRCAT "P" NO1))
      (COMMAND "LAYER" "M" "ID" "C" "C" "" "")
      (COMMAND "STYLE" "ITALICT" "ITALICT" H "1" "" "" "" "" )
      (COMMAND "TEXT" pnt1 ang  NO2)
      (COMMAND "DONUT" "0" z pnt "")
      (COMMAND "TEXT" CRN ang  NO2)
      (COMMAND "TEXT" CRN1 ang  EPNT)
      (COMMAND "TEXT" CRN2 ang  NPNT)
        (SETQ CRN (POLAR CRN (+ angle 4.712389) y1)
            CRN1 (POLAR CRN1 (+ angle 4.712389) y1)
            CRN2 (POLAR CRN2 (+ angle 4.712389) y1)
            NO (1+ NO)
            PNT (GETPOINT "\nPick next coordinate, or RETURN if done: "))
)
(setvar "osmode" 0)
(setq p4 (polar crn (+ angle 3.14) h)
     p5 (polar crn1 (+ angle 3.14) h)
     p6 (polar crn2 (+ angle 3.14) h)
     p15 (polar p6 angle  y ))
(command "line" p10 p4 "")
(command "line" p11 p5 "")
(command "line" p12 p6 "")
(command "line" p4 p15 "")
(command "line" p7 p14 "")
(command "line" p10 p13 "")
(command "line" p13 p15 "")
(setq h1 ( * 1.2 h))
(COMMAND "STYLE" "ITALICT" "ITALICT" H1 "1" "" "" "" "" )
(COMMAND "TEXT" ins1 ang  "Point")
(COMMAND "TEXT" ins2 ang  "Easting")
(COMMAND "TEXT" ins3 ang  "Northing")



)

Posted

You have used the angle function as a variable which is not recommended although you did not localized them and the rest as well .

e.g .

 

(SETQ CRN (GETPOINT "\n Enter Top Left Start corner for table: ")
              [b][color="blue"]angle[/color][/b] (getangle "\n Pick Rotation Angle :")
              ang (* angle 57.32484076)
              NO (GETINT " \n Enter start number : ")
              PNT (GETPOINT "\n Pick first coordinate: ")
              CRN1 (POLAR CRN angle x)
              CRN2 (POLAR CRN1 angle y)) 

 

must be corrected in the rest of the routine . ...

 

and for the insertion of the block and since that you're using command call , I could say use this .

replace this .

 

(COMMAND "DONUT" "0" z pnt "")

 

with this .

(command "_.-insert" (put here the insertion point ) "" "" "")

 

And finally , please localize your variables to avoid any miss behave of the routine .

Posted

Take the following example, fill in the required information, and replace the donut line with it.

 

(command "_.-insert" <blockname> <insertionpoint> <xscale> <yscale> <rotation>)

Posted

Maybe better as

 

[b][color=#0000ff]ang[/color][/b] (getangle "\n Pick Rotation Angle :")
              ang (* ang 57.32484076)
or just 
[b][color=#0000ff](setq ang[/color][/b] (* 57.32484076 (getangle "\n Pick Rotation Angle :")))
             

Posted

Dear All,

(SETQ CRN (GETPOINT "\n Enter Top Left Start corner for table: ")

angle (getangle "\n Pick Rotation Angle :")

ang (* angle 57.32484076)

NO (GETINT " \n Enter start number : ")

PNT (GETPOINT "\n Pick first coordinate: ")

CRN1 (POLAR CRN angle x)

CRN2 (POLAR CRN1 angle y))

(command "_.-insert" (put here the insertion point ) "" "" "")

(command "_.-insert" )

I tried some suggestions, which is mentioned above as a reply in the forum for my thread.

But still I couldn't get my output.

Let me try to explain my requirement via attached pdf.

Experts, please refer attachment

 

RRS1987

REFERENCE.pdf

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