AllExperts > AutoCAD 
Search      
AutoCAD
Volunteer
Answers to thousands of questions
 Home · More AutoCAD Questions · Answer Library  · Encyclopedia ·
More AutoCAD Answers
Question Library

Ask a question about AutoCAD
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Scott Cook
Expertise
I`ve been using AutoCAD since 1987 and programming AutoLISP nearly as long. I can answer questions about programming AutoCAD (except ARX) and production enhancement techniques. I cannot answer questions about AutoCAD crashes or DWG corruption. AutoCAD PROGRAMMING (menus, lisp) related questions only!

Experience
Since 1987. Author of Plot2000 software for for AutoCAD, http://www.plot2000.com. PROGRAMMING QUESTIONS ONLY PLEASE. Questions that are NOT related to programming or AutoCAD customization (menus and lisp only please) are outside the scope of my volunteer services and will NOT BE ANSWERED.
 
   

You are here:  Experts > Computing/Technology > Computer-Aided Design > AutoCAD > stationing

AutoCAD - stationing


Expert: Scott Cook - 5/27/2003

Question
Hi Scott,

Thank you for your help yesterday on my pline stationing problem:
*****
Scott Cook  Answers  -
yes there is a way to do this. how far along are you with the project? I've actually done this before, it's quite a complex project. You may find dealing with polyline arcs, or "bulges" a fairly complex problem. The other problem area will be "reversing" the polyline, for example if it was drawn in the opposite direction that you want to station it in.
You can figure out the station and offset of any given point along the polyline inside autocad once you know the starting station - no need to write a text file for external calculations.
*********

I have just started the outline for the procedure.  I have to be able to select a pline, or select the starting point of the pline, and calculate stations along the pline... and, be able to export the position of the stations (which are tied to GPS coordinates) as well as the station numbers to a database.  All the pline segments will be straight.  One idea I would like to do is to have the measure command place blocks with station numbers along the line, however, the measure command leaves out the attributes when placing blocks.  So a more complicated method I would like to try is to utilize autoLISP to get a start point, and then find the orientation of the pline segment and travel along it until the osnap command detects an endpoint, then store the endpoint position.  Then I can calc stationing distances based on sequential points and place numbers, blocks, or whatever at these points, which could then be referenced by the database (which I have to create later).  I can 'getpoint' the start position, but I'm not sure how to find the orientation and length of each line segment, or how to use the osnap LISP command.  My final idea involves using the list command to show the properties of the pline, then copy the text window (which shows the vertecies of the pline) and crunch the numbers down in an external application (VBA) to get me the start and endpoints of the pline.  Do any of these ideas sound promising to you?

Thanks for your help,

Carl Loeffelmann,
ACAD 2000

Answer
my routine used measure. the measure command puts the blocks it adds to the previous selection set, so you can just get a selection "previous" selection set with SSGET and loop through it to add or modify attributes in the blocks it added.
you may want to consider not using LWPOLYLINEs, but instead regular ones. The vertex data might be easier to deal with on the old style POLYLINEs.
Once you have the head entity of an old-style polyline, you use ENTNEXT to get the next vertex. you do this till you get a SEQEND entity, which is the end of the polyline. See the DXF reference in the programmers guide to understand the data.
You use the DISTANCE and ANGLE functions to calculate distances and angles between two points. Angles are always in radians - see the help for all these functions if needed.
Scott Cook
Plot2000 Developer
www.plot2000.com  

Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.