Author Topic: Point Manager  (Read 10834 times)

0 Members and 1 Guest are viewing this topic.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Point Manager
« on: December 16, 2009, 10:37:16 AM »
This is a program that I have posted over at CADTutor, but I thought I'd share it with you fine people too  :-)

I wrote it to be a "universal" program to import/export points, my motivation being that I have seen so many requests for programs to either write points to a file, or create points at every point found in a file.

As it stands, the program can:

  • Insert a Block at all Points from a File (txt/csv)
  • Insert an ACAD Point at all Points from a File (txt/csv)
  • Insert an ACAD Point at all vertices on all/Selected LW/3D Polylines in a drawing
  • Create a LW/3D Polyline from all Points in a File (txt/csv)
  • Insert a Block at all/selected Points in a drawing
  • Export all/selected Points in a drawing to a File (txt/csv)
  • Create a LW/3D Polyline from all/Selected Points in a drawing
  • Insert a Block at all vertices of a LW/3D Polyline
  • Export all Vertices of a LW/3D Polyline to a File (txt/csv)
  • Create a LW/3D Polyline from all/selected LW/3D Polylines
  • Export all insertions of a Block to a File (txt/csv)
  • Insert a Point at all instances of a Block
  • Create a LW/3D Polyline at all insertions of a Block

<< More Information Can be Found by Clicking the "Help" Button >>

Dialog Preview:



Point Format Dialog:



Object Options Dialog:



Function Syntax:  PtManager  / PtM

More instructions are found in the header:

Code: [Select]
;;;¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,;;;
;;;ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,¤º°`°º¤;;;
;;                                                                               ;;
;;                                                                               ;;
;;                          --=={  Point Manager  }==--                          ;;
;;                                                                               ;;
;;  Program will allow the user to manipulate points in the drawing or a file in ;;
;;  a variety of ways, including:                                                ;;
;;                                                                               ;;
;;  From File:-                                                                  ;;
;;  --------------                                                               ;;
;;                                                                               ;;
;;  - Insert a Block at all Points from a File (txt/csv)                         ;;
;;  - Insert a Point at all Points from a File (txt/csv)                         ;;
;;  - Create an LW/3D Polyline from all Points in a File (txt/csv)               ;;
;;                                                                               ;;
;;  From ACAD Points:-                                                           ;;
;;  ---------------------                                                        ;;
;;                                                                               ;;
;;  - Insert a Block at all/selected Points in a drawing                         ;;
;;  - Export all/selected Points in a drawing to a File (txt/csv)                ;;
;;  - Create an LW/3D Polyline from all/Selected Points in a drawing             ;;
;;                                                                               ;;
;;  From LW/3D Polylines:-                                                       ;;
;;  --------------------------                                                   ;;
;;                                                                               ;;
;;  - Insert a Block at all vertices of an LW/3D Polyline                        ;;
;;  - Export all Vertices of an LW/3D Polyline to a File (txt/csv)               ;;
;;  - Insert a Point at all Vertices of an LW/3D Polyline                        ;;
;;  - Create an LW/3D Polyline from all/selected LW/3D Polylines                 ;;
;;                                                                               ;;
;;  From Blocks:-                                                                ;;
;;  ----------------                                                             ;;
;;                                                                               ;;
;;  - Export all insertions of a Block to a File (txt/csv)                       ;;
;;  - Insert a Point at all instances of a Block                                 ;;
;;  - Create an LW/3D Polyline at all insertions of a Block                      ;;
;;                                                                               ;;
;;                                                                               ;;
;;  When reading from/writing to Files, a data delimiter may be selected from    ;;
;;  the drop-down, with the exception of using a CSV file, in which a comma must ;;
;;  be used.                                                                     ;;
;;                                                                               ;;
;;  The user can also choose to sort the points by X/Y/Z Coordinate, in          ;;
;;  Ascending or Descending order.                                               ;;
;;                                                                               ;;
;;  When the input is of Block type and output of File type (or vice-versa),     ;;
;;  Block Attributes may be written (or entered).                                ;;
;;                                                                               ;;
;;                                                                               ;;
;;                 --<<  Click Help for more information  >>--                   ;;
;;                                                                               ;;
;;                                                                               ;;
;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=;;
;;                                                                               ;;
;;  FUNCTION SYNTAX:  PtManager  /  PtM  /  PTM_clear (Resets Defaults)          ;;
;;                                                                               ;;
;;  Notes:-                                                                      ;;
;;  -----------                                                                  ;;
;;  If no Z-Coord is found, zero elevation is assumed.                           ;;
;;                                                                               ;;
;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=;;
;;                                                                               ;;
;;  AUTHOR:                                                                      ;;
;;                                                                               ;;
;;  Copyright © Lee McDonnell, December 2009. All Rights Reserved.               ;;
;;                                                                               ;;
;;      { Contact: Lee Mac @ TheSwamp.org, CADTutor.net }                        ;;
;;                                                                               ;;
;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=;;
;;                                                                               ;;
;;  VERSION:                                                                     ;;
;;                                                                               ;;
;;    ø 1.0   ~¤~   5th December 2009   ~¤~   º First Release                    ;;
;;...............................................................................;;
;;    ø 1.1   ~¤~   5th December 2009   ~¤~   º Added Dialog interface.          ;;
;;...............................................................................;;
;;    ø 1.2   ~¤~  11th December 2009   ~¤~   º Updated Dialog Interface to      ;;
;;                                              allow for various input/output.  ;;
;;...............................................................................;;
;;    ø 1.3   ~¤~  12th December 2009   ~¤~   º Added ability to Create LW and   ;;
;;                                              3D Polylines.                    ;;
;;...............................................................................;;
;;    ø 1.4   ~¤~  14th December 2009   ~¤~   º Added ability to select data     ;;
;;                                              delimiter when reading from/     ;;
;;                                              writing to files.                ;;
;;...............................................................................;;
;;    ø 1.5   ~¤~  17th December 2009   ~¤~   º Fixed Bug when selecting 3D poly ;;
;;                                              as output.                       ;;
;;...............................................................................;;
;;    ø 1.6   ~¤~  26th December 2009   ~¤~   º Added Ability to Extract Block   ;;
;;                                              information.                     ;;
;;...............................................................................;;
;;    ø 1.7   ~¤~  29th December 2009   ~¤~   º Added ability to sort points.    ;;
;;                                            º Added option to write/enter      ;;
;;                                              block attributes.                ;;
;;                                            º Improved Default Handling.       ;;
;;                                            º Added option to use 'other'      ;;
;;                                              delimiter.                       ;;
;;                                            º Added ability to change point    ;;
;;                                              format.                          ;;
;;...............................................................................;;
;;    ø 1.8   ~¤~    2nd January 2010   ~¤~   º Created Help File & added Help   ;;
;;                    (Not Released)            button.                          ;;
;;                                            º Fixed bug when selecting a block ;;
;;                                              input.                           ;;
;;...............................................................................;;
;;    ø 1.9   ~¤~    4th January 2010   ~¤~   º Modified Delimiter functions to  ;;
;;                                              accept delimiters of length > 1. ;;
;;...............................................................................;;
;;    ø 2.0   ~¤~    5th January 2010   ~¤~   º Modified Delimiter Mode_Tile     ;;
;;                                              functions.                       ;;
;;                                            º Fixed bug when selecting output  ;;
;;                                              block from drawing.              ;;
;;...............................................................................;;
;;    ø 2.1   ~¤~    7th January 2010   ~¤~   º Corrected Help File Typo.        ;;
;;                                            º Updated Delimiter Check Function ;;
;;...............................................................................;;
;;    ø 2.2   ~¤~    7th January 2010   ~¤~   º Added Object Options Button and  ;;
;;                                              Dialog.                          ;;
;;...............................................................................;;
;;    ø 2.3   ~¤~      8th March 2010   ~¤~   º Fixed bug to include elevation.  ;;
;;                                            º Added code to disable/enable     ;;
;;                                              Object Options button.           ;;
;;...............................................................................;;
;;    ø 2.4   ~¤~     19th April 2010   ~¤~   º Fixed bug when reading from      ;;
;;                                              files.                           ;;
;;...............................................................................;;
;;                                                                               ;;
;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=;;
;;                                                                               ;;
;;;¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,;;;
;;;ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,¤º°`°º¤;;;

As always, your comments/criticism and suggestions for improvement, are very welcome.

Enjoy!

Lee


--=={ Code Updated to Version 2.4 }==--

Code available here.
« Last Edit: November 14, 2010, 08:11:55 PM by Lee Mac »

Harrie

  • Guest
Re: Point Manager
« Reply #1 on: December 16, 2009, 02:05:08 PM »
I see as output LW polylines and 2D polylines, but not a 3D polyline(Open space).

Regards, Harrie.
« Last Edit: December 16, 2009, 02:11:06 PM by Harrie »

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Point Manager
« Reply #2 on: December 16, 2009, 08:17:41 PM »
My apologies Harrie - a slight mistake on my part.  :oops:

I have updated the code to Version 1.5 and have rename the "2D Polyline" to "LW Polyline" to avoid confusion with the heavy 2D Polyline.

Lee

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Point Manager
« Reply #3 on: December 26, 2009, 08:18:53 AM »
Code in first post updated to Version 1.6, added Block as input type  :wink:

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Point Manager
« Reply #4 on: December 29, 2009, 06:01:45 PM »
I decided to invest a little time in this program and have updated the first post to Version 1.7.

This is a huge update, which adds a load of new features to the program, including the ability to sort points, change the point format, write/enter block attributes, choose an arbitrary data delimiter, among many other exciting updates.

Of course, your feedback is very welcome!

Enjoy,

Lee

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Point Manager
« Reply #5 on: December 29, 2009, 11:31:11 PM »
Thanks Lee, been too busy with the Holidays to give it a test drive but I will soon.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Point Manager
« Reply #6 on: December 30, 2009, 08:07:53 AM »
Thanks Lee, been too busy with the Holidays to give it a test drive but I will soon.


Thanks Alan - I had fun making it  :-)

Pad

  • Bull Frog
  • Posts: 342
Re: Point Manager
« Reply #7 on: January 04, 2010, 05:39:00 AM »
Hi Lee

Your half way there to a good survey point importer.
Would be great to be able to code the points before import, so that line work can be on different layers, different blocks can be inserted, rectangles drawn, arcs etc.. and all at a predetermined scale.

Cheers
Pad

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Point Manager
« Reply #8 on: January 04, 2010, 08:06:20 AM »
Thanks for the suggestion Pad, I appreciate it.

I am releasing a new version of this program momentarily, which squishes a few bugs, and also provides a help feature.

Regarding your suggestion, were you referring to perhaps having options on the dialog to choose layers/scale etc, or rather in the input file?

Thanks for the interest in the program,

Lee

Pad

  • Bull Frog
  • Posts: 342
Re: Point Manager
« Reply #9 on: January 04, 2010, 09:05:05 AM »
Hi Lee

the input file would have to have the code assigned already.
The point manager would then the interpret the codes possibly through a config file to then draw, lines on certain layers, with or without levels, rectangles, arcs, circles, blocks with orientation and scale etc.. it can become quite complex.

Attached are a couple of pictures showing what we currently use.

If its something you'd like to pursue further I can certainly provide you with more information

Cheers
P

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Point Manager
« Reply #10 on: January 04, 2010, 09:13:05 AM »
Wow! That looks like a huge amount of work... I'm not sure that I could take this that far... especially as it is just a "hobby"  ;-)

But I have a few extra ideas that would not be too hard to incorporate.

Thanks for the information and suggestions Pad!

Lee

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Point Manager
« Reply #11 on: January 04, 2010, 09:25:44 AM »
As promised, I have updated the code in the first post to Version 1.9.

I have fixed a few of the bugs found when using a Block as the input type, and have also modified a few of the functions to allow a Data delimiter of length greater than 1.

This version also includes a help button, which should provide enough information to get you going.  :-)

Enjoy!

Lee

Pad

  • Bull Frog
  • Posts: 342
Re: Point Manager
« Reply #12 on: January 04, 2010, 09:48:56 AM »
Yeah it could certainly start to snowball!

Look forward to seeing this evolve a little.

thanks
P

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Point Manager
« Reply #13 on: January 04, 2010, 11:45:06 AM »
Yeah it could certainly start to snowball!

Look forward to seeing this evolve a little.

Well, I was thinking of adding a section for Block Scale and also, a layer drop-down (currenly everything is inserted/created on the current layer), but I don't think I could get it to the level that you have posted - that looks like a very specialist program.

Just curious, is it freeware?


Pad

  • Bull Frog
  • Posts: 342
Re: Point Manager
« Reply #14 on: January 04, 2010, 12:31:21 PM »
unfortunately not
http://www.keycivil.com/products/land.shtml
Its more of a ground modelling package.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Point Manager
« Reply #15 on: January 04, 2010, 01:01:04 PM »
unfortunately not
http://www.keycivil.com/products/land.shtml
Its more of a ground modelling package.

I thought as much - it would take an extremely generous person to give that much away  ;-)

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Point Manager
« Reply #16 on: January 05, 2010, 03:12:04 PM »
Thanks to a bug report from one of the members over at CADTutor, I have updated the first post to Version 2.0

If anyone finds any other bugs - please let me know!  :wink:

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Point Manager
« Reply #17 on: January 07, 2010, 09:11:08 AM »
Updated to Version 2.2, includes an Object Options Dialog  :wink:

XXL66

  • Guest
Re: Point Manager
« Reply #18 on: January 09, 2010, 05:22:20 AM »
Nice work so far Lee.

Try to add lines connected with codes like Pad says.
I have done a similar function (but this works besides coordinates also on raw field data).
After connecting lines, you can add construction codes, then there is no limit  :wink:

Attached you can see a sample. Every object is created using pointcodes. Construction codes include perpendicular lines on the buildings and their housenumbers f.e. Lengthen/shorten lines, create a perpendicular corner to the next point. Extend to sideshot line, define arcs, create parallel lines (distance but also measured true point), text remarks, point labels, blocks, you name it.

I use a DWT file where blocks, layers etc are used as reference. Every DWT has a codetable (same name difference extension), this is where fieldcodes are linked to objects like points, lines, blocks. Editing the codes is done in the DWT. It's possible to define default lengths for the perpedicular lines, distance aligned texts etc... and of course all entity properties. Even default excentric offset for each individual featurecode is possible (f.e. measuring a corner of a building with a robotic total station, the operator just has to enter code +x or -x for the default distance).

I'm currently porting everything to BricsCAD.



Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Point Manager
« Reply #19 on: May 03, 2010, 12:37:35 PM »
Updated to Version 2.4 - bug fixes as reported from CADTutor  :-)

mdbdesign

  • Newt
  • Posts: 52
Re: Point Manager
« Reply #20 on: November 16, 2011, 08:32:02 AM »
Lee, there is question form one user:
When output type is a block, is there possibilities to rotate it perpendicular to polyline?
Marek

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Point Manager
« Reply #21 on: November 16, 2011, 08:37:58 AM »
Lee, there is question form one user:
When output type is a block, is there possibilities to rotate it perpendicular to polyline?

I'm afraid this is not possible with the current program.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Point Manager
« Reply #22 on: November 16, 2011, 09:52:59 AM »
Lee, there is question form one user:
When output type is a block, is there possibilities to rotate it perpendicular to polyline?
I wrote this a while back. It would have to be used after importing the blocks with Lee's code, but it'd be a solution to aligning the blocks to your polyline.

Code: [Select]
(defun c:RAC (/ ss ent)
  ;; Rotate blocks Along Curve
  ;; Required subroutines: AT:GetSel, AT:AngleAtPoint
  ;; Alan J. Thompson, 12.20.10

  (vl-load-com)

  (if (and (setq ss (ssget "_:L" '((0 . "INSERT"))))
           (setq ent
                  (car
                    (AT:GetSel
                      entsel
                      "\nSelect curve to rotate objects along: "
                      (lambda (x)
                        (not (vl-catch-all-error-p (vl-catch-all-apply 'vlax-curve-getEndParam (list (car x))))
                        )
                      )
                    )
                  )
           )
      )
    (progn
      (vlax-for x (setq ss (vla-get-activeselectionset
                             (cond (*AcadDoc*)
                                   ((setq *AcadDoc* (vla-get-activedocument
                                                      (vlax-get-acad-object)
                                                    )
                                    )
                                   )
                             )
                           )
                  )
        (vl-catch-all-apply
          (function
            (lambda (/)
              (vla-put-rotation
                x
                (AT:AngleAtPoint
                  ent
                  (vlax-curve-getClosestPointToProjection ent (vlax-get x 'InsertionPoint) '(0 0 1))
                )
              )
            )
          )
        )
      )
      (vla-delete ss)
    )
  )
  (princ)
)





(defun AT:GetSel (meth msg fnc / ent)
  ;; meth - selection method (entsel, nentsel, nentselp)
  ;; msg - message to display (nil for default)
  ;; fnc - optional function to apply to selected object
  ;; Ex: (AT:GetSel entsel "\nSelect arc: " (lambda (x) (eq (cdr (assoc 0 (entget (car x)))) "ARC")))
  ;; Alan J. Thompson, 05.25.10
  (setvar 'ERRNO 0)
  (while
    (progn (setq ent (meth (cond (msg)
                                 ("\nSelect object: ")
                           )
                     )
           )
           (cond ((eq (getvar 'ERRNO) 7) (princ "\nMissed, try again."))
                 ((eq (type (car ent)) 'ENAME)
                  (if (and fnc (not (fnc ent)))
                    (princ "\nInvalid object!")
                  )
                 )
           )
    )
  )
  ent
)





(defun AT:AngleAtPoint (e p)
  ;; Return angle along curve, at specified point (on curve)
  ;; e - valid curve (ENAME or VLA-OBJECT)
  ;; p - point on curve
  ;; Alan J. Thompson, 11.04.10
  (angle '(0. 0. 0.) (vlax-curve-getFirstDeriv e (vlax-curve-getParamAtPoint e p)))
)
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

mdbdesign

  • Newt
  • Posts: 52
Re: Point Manager
« Reply #23 on: November 16, 2011, 10:20:20 AM »
Will try it.
Thank you.
Marek