Jump to content

Recommended Posts

Posted

Hi, I am trying to find a solution to automatically draw a pline right in the middle (half distance) of two other almost parallel plines, as in a road axis, for example. The two plines are always drawn manually and are never exactly parallel, so something based on copy (like offset) won't do. As I could not find any script that does the job, I am trying to do it in VBA. It would use SelectOnScreen to have the user select the two plines, and then would iterate through all the points of one pline, and for each one it would find the nearest point on the other pline and calculate and save the mid distance point. After the iteration, a new pline would be drawn, passing through all the saved points. The problem is I couldn't succeed in finding a way in VBA to use OSNAP to pick the nearest point on the other pline. I understand that LISP has a function for that, but I couldn't find a way to return the result to VBA. I am leaning on VBA because I am already moderatly proficient with this language, as opposed to zero experience in LISP. Any suggestions? Tks

Posted

As I explained here (http://www.cadtutor.net/forum/showthread.php?t=39859), this type of task, curve analysis, is particularly tricky with VBA (VBA/VB6 does not have direct access to the appropriate API). It would be significantly easier with VB.NET, but I see you are still using AutoCAD 2005, which precludes that option.

 

If lisp is not an option then, essentially, there are two remaining choices: Write your own routines to do a piecewise analysis of the polylines, (See example linked in my response to that thread).

 

or,

 

Find and download the “Curves.cls”. That class allows the use of some native AutoCAD libraries that help the process. Here is a recent link:

 

http://discussion.autodesk.com/forums/thread.jspa?threadID=746328&tstart=0

Posted

Dear Seant,

 

Many tks for your reply, with some hints that pointed me in the right direction.

 

I downloaded Curves.cls for later investigation, but for the moment I chose to build my own, very basic routines, just for the fun of it.

 

So far, they behave as expected, and although not fool-proof for every situation, they do the trick.

 

Thanks again.

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