Jump to content

Recommended Posts

Posted

Hello, can anyone help me in finding or makind a autocad lisp to draw vegetation and paths in profile?

 

i attach a image so you can understand what i need, choosing the star and end of the polyline it makes a offset of the profile with a distance that the lisp asks. and connect vertical lines.

 

Can it be done with a lisp? thanks in advance it will be very helpful , because i have a powerline project to make and that is a long time consuption.... best regards

lisp.png

Posted

Can you program a LISP routine - trying to work out where we need to start from to help you.

 

You can select the start and end point for your vertical lines where they connect to the profile with the (getpoint ) command

You can get the user to enter line length with (getstring )

and select the profile polyline with (entsel )

(internet search will show you the syntax for all of these)

 

Then all it takes is draw 2 lines the right length starting at the 2 points, offset the profile and chamfer that (with a distance of 0) to the vertical lines, perhaps to copy your profile and chamfer the copy to the vertical lines to create a closed polyline for example to hatch later.

 

So yes it is very possible to do this... but what is our starting point, where have you got and where are you stuck?

Posted

Like Steven P draw the 2 lines and copy pline up,  trim using window is your friend all done. Manual version. 

 

Ps use copy as a pline will change shape when using offset.

  • Like 1
Posted

Thanks for the feedback, i have not experience in programming lisps but i will try, i need this because in a long profile it is a very time consuming doing this. best regards

Posted
1 hour ago, rsequeira said:

Thanks for the feedback, i have not experience in programming lisps but i will try, i need this because in a long profile it is a very time consuming doing this. best regards

 

That's not a problem, some people know some LISP programming, some not a lot and some (not you) do know what to do but want a ready made solution without having to do the work.

 

So starting from the beginning, open a text editor (I use windows notepad) and save the file as you want but with a .lsp extension, for example offsetprofile.lsp.

 

In it you need to define the LISP routine and once done follow Lee Macs tutorial ( http://www.lee-mac.com/runlisp.html ) to load and run the LISP.

 

Now perhaps copy into your new text file this, when you follow Lee Macs tutorial above running this it should write "Lisp Created and Runs" n the command line... you've made a LISP, and now the fun starts making it do something useful. 

 

(defun c:offsetprofile ( / )
  (princ "\Lisp Created and Runs")
)

 

Can do this in stages, below will ask the user for information, replace the above with. The reload it as Lee Mac, above.

 

(defun c:offsetprofile ( / PT1 PT2 MyOffset MyProfile)
  (setq Pt1 (getpoint "\nSelect Point 1"))
  (setq Pt2 (getpoint "\nSelect Point 2"))
  (setq MyOffset 0)
  (while (= MyOffset 0)
    (setq MyOffset (atoi (getstring "\nEnter Offset")))
    (if (= 0 MyOffset) (princ "Now try entering a number instead."))
  )
  (setq MyProfile (car (entsel "\nSelect Profile")))
)

 

So this should now ask the user to select the start point of each line (saved as variables Pt1 and Pt2), to enter a number for the offset (variable MyOffset) and to select the profile to offset (variable MyProfile)

 

 

Let us know how you get on with this and can do the next stage after (I am on holiday his afternoon someone else might help with the next stages). Next stage... drawing lines and copy the profile.

 

Posted

Like Steven P a bit more for you how to draw the vertical lines.

 

(setq pt3 (polar pt1 (/ pi 2.) (+ 10 myoffset))) ;  over draw line length by 10 
(setq pt4 (polar pt2 (/ pi 2.) (+ 10 myoffset))) ;  over draw line length by 10 
(command "line" pt1 pt3 "")
(command "line" pt2 pt4 "")

 

(setq MyOffset (atof (getstring "\nEnter Offset"))) ; using atof allows decimal values atoi is integer change if required

 

(command "copy" myprofile "" (list 0.0 0.0) (list 0.0 myoffset)) ; copys the profile vertical 

 

Now do a trim or a fillet, look into using "pause" in the command.

 

You can use osnap to pick points on the profile but that depends on how you want it like, end or near.

 

You can go further you may want to look into remembering last offset value a slightly different (while function that displays value and enter accepts last value. Add a while to the pick pt1 so keeps repeating. Start simple we are here to help do it step by step.

 

My front end remembers last value for the moment get it all to work.

 

image.png.bb2d0939ea373d448b115051817aa64a.png

 

  • Like 1

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