# Thread: Create circle from information supplied

1. Login to Give a bone

## Create circle from information supplied

I am trying to create a circle at each tip like in the drawing that I've attached (Eg_00.dwg). I intend to have the user to enter the circle diameter and circle offset distance. The circle offset distance is from end of tip to centre point of the circle. I really need help with this lisp. Any help be greatly appreciated!

2. Login to Give a bone

## Re: Create circle from information supplied

I've got a program that does something similar. You select a lin and the circle is placed at the end of the line with a number in it. YOu specify the circle radius and text height along with the starting number. Give it a try it may be waht you are looking for.

3. Login to Give a bone

## Re: Create circle from information supplied

1. How are you planning on selecting the lines to add the circle to?
-- this will determine how you get the right end point of the lines

After you have done this, and know which end point to offset from, then it shouldn't be to hard. You will get the line, get the angle of the line (reverse if it happens to be the end point of the line instead of the start point) use the 'polar' function to get the offset'ed point, then use the circle command to draw the circle.

Tip: You may want to turn of osnaps when doing it, and then at the end of you routine, turn them back on.

4. Login to Give a bone

## Re: Create circle from information supplied

The ideas are:
1) Select the all the lines that I want to add the circle to
2) Remove entity that is not related to from selection set
3) Convert all lines (selection set) to polylines
Q: How to write lisp that can convert lines to polylines?

5. Login to Give a bone

## Re: Create circle from information supplied

This will change lines and arcs to PolyLines.

Code:
```(defun C:L2P ()
(setvar "CMDECHO" 0)
(setq	SS1
(ssget	"X"
'((-4 . "<OR") (0 . "LINE") (0 . "ARC") (-4 . "OR>"))
)
)
;end setq
(if (not SS1)
(progn (setq N     (sslength SS1)
)
(prompt "\n")
(setq COUNT 0)
(setq SMEMBER (ssname SS1 COUNT))
(while SMEMBER
(prompt "\r Lines Remaining to Alter: ")
(princ N)
(prompt ".   ")
(command "change" SMEMBER "" "p" "c" "m" "")
(command "PEDIT" SMEMBER "Y" "X")
(setq COUNT (+ 1 COUNT))
(setq SMEMBER (ssname SS1 COUNT))
(setq N (- N 1))
)
(setvar "CMDECHO" 1)
(prompt "\n ")
(princ "\rPreparing to Change Entity Colors to BYLAYER ...")
(command "change" SSNEW "" "p" "c" "bylayer" "")
); end of progn
); end of if
(princ)
)```

6. Login to Give a bone

## Re: Create circle from information supplied

I've tried to write the routine but got error when i've tested it in autocad2004.The routine requires that the tips be selected by layer name.Then the user need to select non tip entity by crossing window. The user supplies circle radius, offset distance, clockwise or counter clockwise, and approximate start location by selecting a tip.
Here I've attached my routine. Please kindly help me on solve this problem. Thanks.

7. Login to Give a bone

## Re: Create circle from information supplied

Anyone can help on lisp that create a circle at each tip like in the drawing that I've attached (Eg_00.dwg) in first thread? I really need help with this lisp. Any help be greatly appreciated!

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•