DRAW POLYLINE & INSERT BLOCK LISP

DRAW POLYLINE & INSERT BLOCK LISP

Sunny2006
Enthusiast Enthusiast
514 Views
7 Replies
Message 1 of 8

DRAW POLYLINE & INSERT BLOCK LISP

Sunny2006
Enthusiast
Enthusiast

please i  need a  help write a lisp 

selecting point1 ( on blank space )

Point 2 On a polyline

Is possible to write a lisp that draws a  L shape polyline and insert the block on the polyline line 

 

Sunny2006_0-1708452925892.png

 

0 Likes
515 Views
7 Replies
Replies (7)
Message 2 of 8

Sea-Haven
Mentor
Mentor

Yes very easy, a good learning exercise, so have a go. We are here to help.

 

Pick a point 

Pick a second point for direction

Pick a point for side direction

Then break line putting gap, use polar for gap width

Add block, side direction determines if you need to mirror.

Draw yellow pline use Polar command to work out points for new pline.

 

 

0 Likes
Message 3 of 8

Kent1Cooper
Consultant
Consultant

@Sea-Haven wrote:

....

Then break line putting gap, use polar for gap width

.....


... or build the Block with a wipeout in it, so you don't need to Break the original object.

Kent Cooper, AIA
Message 4 of 8

Sunny2006
Enthusiast
Enthusiast

When I use Wipeout blocks, I can't able to make automatic Dimension, by using lisps ;

 

Sunny2006_0-1708531492054.png

 

0 Likes
Message 5 of 8

Sea-Haven
Mentor
Mentor

Did you make it work ?

0 Likes
Message 6 of 8

Sunny2006
Enthusiast
Enthusiast

I am not that advanced in coding 😞

A modified code of existingcode here ;

 

(defun c:Branch ( / p r Usersnap)

(if (and (setq p (getpoint "\nSTARTING POINT: "))
(setq Usersnap (getvar 'osmode))
(setvar 'osmode 128)
(setq r (getpoint p "\nPIPE BREAK POINT: ")))

(progn
(command "_.insert" "VRF YEE" "_s" 1 "_r" (angtos (+ (/ pi 2) (angle r p))) "_non" r
"_Pline" "_j" "_z" "_s" 20 "_non" p "_non" (polar r (angle r p) 25.5) "")
(setvar 'osmode Usersnap))

)
(princ)
)

 

 

0 Likes
Message 7 of 8

Sea-Haven
Mentor
Mentor

Your dimensions look for a line with a break in them, your code does not break ? Once you do that you can not join the plines. Use points p and r to break. Also use osmode 512 for both pick points.

0 Likes
Message 8 of 8

Kent1Cooper
Consultant
Consultant

@Sunny2006 wrote:
....
"_Pline" "_j" "_z" "_s" 20 ....
....

Those look like answers to prompts in a MLINE command [Justification Zero, Scale 20], not a PLINE command.  Unlike MLINEs, PLINEs don't have justification choices -- their Width [not Scale] is always centered around the defining points [like Zero Justification in MLINE].  And if you're intending a Width setting, you don't get that option until after the first point has been given, and you need to give it two responses for the beginning and end of the segment.  What are you really trying to do?

Kent Cooper, AIA
0 Likes