Author Topic: EaglePoint block to c3d points  (Read 4521 times)

0 Members and 1 Guest are viewing this topic.

cadtag

  • Swamp Rat
  • Posts: 1152
EaglePoint block to c3d points
« on: July 06, 2016, 09:06:02 AM »
Any quick tricks to doing this?  I just got in a dwg file created with EaglePoint 2011 and am hoping there's a efficient way to do this.

BB -- I know you've got an EP person left in house...
The only thing more dangerous to the liberty of a free people than big government is big business

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: EaglePoint block to c3d points
« Reply #1 on: July 06, 2016, 10:45:18 AM »
Any quick tricks to doing this?  I just got in a dwg file created with EaglePoint 2011 and am hoping there's a efficient way to do this.

BB -- I know you've got an EP person left in house...

data EXtract to new point file .csv
Be your Best


Michael Farrell
http://primeservicesglobal.com/

Jeff_M

  • King Gator
  • Posts: 4087
  • C3D user & customizer
Re: EaglePoint block to c3d points
« Reply #2 on: July 06, 2016, 10:53:58 AM »
I wrote a lisp to convert EP blocks to CogoPoints a few years ago. Not finding it on this computer, though. Can you post a dwg file with a few EP points in it?

sdunn

  • Newt
  • Posts: 90
Re: EaglePoint block to c3d points
« Reply #3 on: July 06, 2016, 12:57:07 PM »
Attached drawing with EP points in it.

Jeff_M

  • King Gator
  • Posts: 4087
  • C3D user & customizer
Re: EaglePoint block to c3d points
« Reply #4 on: July 06, 2016, 01:43:07 PM »
Thanks for the drawing. Can you tell me how many different block names EP used for their points? I found an old forum thread on the Autodesk site which mentioned block names CIR & CIRC, I see this dwg uses PLUS. Now, if they all use the same 3 attribute Tags (which these seem familiar... PN, PD, & ZC) then the Block table could be culled for all of them using those attributes.

BlackBox

  • King Gator
  • Posts: 3770
Re: EaglePoint block to c3d points
« Reply #5 on: July 06, 2016, 01:59:02 PM »
Any quick tricks to doing this?  I just got in a dwg file created with EaglePoint 2011 and am hoping there's a efficient way to do this.

BB -- I know you've got an EP person left in house...

I do, sadly... But he's the VP of the firm Haha... So I does what I need to does. :-D

I wrote this back when I was at the big firm using 2014, as we had an external surveyor who also used EP... Initially, I just used to convert EG shots to ASCII:

Code - Auto/Visual Lisp: [Select]
  1.  
  2. (defun c:TopoToAscii (/ *error* ss n path acApp acDoc oShell file tag i z pt ii)
  3.  
  4.   (defun *error* (msg)
  5.     (if oShell
  6.       (vlax-release-object oShell)
  7.     )
  8.     (if file
  9.       (close file)
  10.     )
  11.     (cond ((not msg))                                                   ; Normal exit
  12.           ((member msg '("Function cancelled" "quit / exit abort")))    ; <esc> or (quit)
  13.           ((princ (strcat "\n** Error: " msg " ** ")))
  14.     )                                                                   ; Fatal error, display it
  15.     (princ)
  16.   )
  17.  
  18.   (if (and (princ "\nSelect 3## blocks to export to ASCII: ")
  19.            (setq ss (ssget "_:L" '((0 . "INSERT") (2 . "3##"))))
  20.            (setq n (sslength ss))
  21.            (setq path
  22.                   (strcat (vl-filename-directory (vl-filename-mktemp))
  23.                           "\\"
  24.                           (vl-filename-base (getvar 'dwgname))
  25.                           "_"
  26.                           (menucmd "M=$(edtime,$(getvar,date),YYYY-MO-DD)")
  27.                           ".txt"
  28.                   )
  29.            )
  30.            (setq acApp (vlax-get-acad-object))
  31.            (setq acDoc (vla-get-activedocument acApp))
  32.            (setq oShell
  33.                   (vla-getinterfaceobject acApp "Shell.Application")
  34.            )
  35.       )
  36.     (progn
  37.       (setq file (open path "w"))
  38.         (foreach attrib (vlax-invoke x 'GetAttributes)
  39.           (cond ((= "PN" (setq tag (vla-get-tagstring attrib)))
  40.                  (setq i (vla-get-textstring attrib))
  41.                 )
  42.                 ((= "ZC" tag)
  43.                  (setq z (vla-get-textstring attrib))
  44.                 )
  45.           )
  46.         )
  47.         (write-line
  48.           (strcat
  49.             i
  50.             ","
  51.             (rtos (cadr (setq pt (vlax-get x 'insertionpoint))))
  52.             ","
  53.             (rtos (car pt))
  54.             ","
  55.             (if (setq ii (vl-string-search "=" z))
  56.               (substr z (+ 2 ii))
  57.               z
  58.             )
  59.             ","
  60.             (vla-get-effectivename x)
  61.           )
  62.           file
  63.         )
  64.       )
  65.       (setq file (close file))
  66.       (prompt (strcat "\n** " (itoa n) " block" (if (= 1 n) "" "s") " processed ** "))
  67.       (vlax-invoke oShell 'open path)
  68.       (*error* nil)
  69.     )
  70.     (cond (acDoc
  71.            (*error* "Unable to create \"Shell.Application Object\"")
  72.           )
  73.           (n (*error* "Unable to create temporary file"))
  74.           ((*error* "No survey points found"))
  75.     )
  76.   )
  77. )
  78.  


However, that option does not leverage Point Groups, which makes it a lot easier to handle all of their blocks, and not just EG shots.

For that, I ended up 'converting' the EP Blocks to COGO Points, retaining the Point Numbers where possible, update the Point Groups, and Regen, etc... Just update the Block/Layer names as needed (my office rejects NCS, and insists on using their layers from 30 years ago *shrugs*):

Code - Auto/Visual Lisp: [Select]
  1.  
  2. (defun c:ConvertBlockToCogo
  3.        (/ *error* vrsn acApp aeccApp aeccDoc aeccDb oPoints acDoc n ss oPoint pt blockName oTreeLabel)
  4.  
  5.   (defun *error* (msg)
  6.     (if ss
  7.       (vla-delete ss)
  8.     )
  9.     (if aeccApp
  10.       (vlax-release-object aeccApp)
  11.     )
  12.     (if acDoc
  13.       (vla-endundomark acDoc)
  14.     )
  15.     (cond ((not msg))                                                   ; Normal exit
  16.           ((member msg '("Function cancelled" "quit / exit abort")))    ; <esc> or (quit)
  17.           ((princ (strcat "\n** Error: " msg " ** ")))                  ; Fatal error, display it
  18.     )
  19.     (princ)
  20.   )
  21.  
  22.   (if
  23.     (and
  24.       (ssget "_:L" '((0 . "INSERT") ;|(2 . "3##")|;))
  25.       (setq vrsn
  26.              (if vlax-user-product-key                                  ; If 2013+
  27.                (vlax-user-product-key)                                  ; Use new function
  28.                (vlax-product-key)                                       ; Use legacy function
  29.              )
  30.       )
  31.       (setq vrsn
  32.              (cond
  33.                ((vl-string-search "21.0" vrsn) "11.0")                  ; 2017
  34.                ((vl-string-search "20.1" vrsn) "10.5")                  ; 2016
  35.                ((vl-string-search "20.0" vrsn) "10.4")                  ; 2015
  36.                ((vl-string-search "19.1" vrsn) "10.3")                  ; 2014
  37.                ((vl-string-search "19.0" vrsn) "10.0")                  ; 2013
  38.                ((vl-string-search "18.2" vrsn) "9.0")                   ; 2012
  39.                ((vl-string-search "18.1" vrsn) "8.0")                   ; 2011
  40.                ((vl-string-search "18.0" vrsn) "7.0")                   ; 2010
  41.                ((vl-string-search "17.2" vrsn) "6.0")                   ; 2009
  42.                ((vl-string-search "17.1" vrsn) "5.0")                   ; 2008
  43.                (T nil)
  44.              )
  45.       )
  46.       (setq aeccApp (vla-getinterfaceobject
  47.                       (setq acApp (vlax-get-acad-object))
  48.                       (strcat "AeccXUiLand.AeccApplication." vrsn)
  49.                     )
  50.       )
  51.       (setq aeccDoc (vlax-get-property aeccApp "ActiveDocument"))
  52.       (setq aeccDb (vlax-get-property aeccDoc "Database"))
  53.       (setq oPoints (vlax-get-property aeccDb "Points"))
  54.       (princ "\nWorking, please wait... ")
  55.       (princ)
  56.     )
  57.      (progn
  58.        (vla-startundomark
  59.        )
  60.        (setq n 0)
  61.        (vlax-for x (setq ss (vla-get-activeselectionset acDoc))
  62.          (setq oPoint (vlax-invoke-method
  63.                         oPoints
  64.                         'add
  65.                         (vlax-3d-point
  66.                           (setq pt (vlax-get x 'insertionpoint))
  67.                         )
  68.                       )
  69.          )
  70.          (vla-put-description
  71.            oPoint
  72.            (setq blockName (vla-get-effectivename x))
  73.          )
  74.          (vla-put-elevation oPoint (last pt))
  75.          (vla-put-layer oPoint (vla-get-layer x))
  76.          (cond
  77.            ((= blockName "51")                                          ; benchmarks
  78.             (foreach attrib (vlax-invoke x 'GetAttributes)
  79.               (if (= "PD" (vla-get-tagstring attrib))
  80.                 (vl-catch-all-apply
  81.                   'vlax-put-property
  82.                   (list oPoint 'name (vla-get-textstring attrib))
  83.                 )
  84.               )
  85.             )
  86.            )
  87.            ((= blockName "182")                                         ; steel posts
  88.             (progn
  89.               (vla-add (vla-get-layers acDoc)
  90.                        (setq layerName (strcat (vla-get-layer x) "-TX"))
  91.               )
  92.               (foreach attrib (vlax-invoke x 'GetAttributes)
  93.                 (if (= "PD" (vla-get-tagstring attrib))
  94.                   (progn
  95.                     (setq oTreeLabel
  96.                            (vlax-invoke-method
  97.                              oPoints
  98.                              'add
  99.                              (vlax-3d-point pt)
  100.                            )
  101.                     )
  102.                     (vla-put-description
  103.                       oTreeLabel
  104.                       (vl-string-subst
  105.                         "-"
  106.                         " "
  107.                         (vla-get-textstring attrib)
  108.                       )
  109.                     )
  110.                     (vla-put-elevation oTreeLabel (last pt))
  111.                     (vla-put-layer oTreeLabel layerName)
  112.                   )
  113.                 )
  114.               )
  115.             )
  116.            )
  117.            ((wcmatch blockName "2##")                                   ; trees
  118.             (progn
  119.               (vla-add (vla-get-layers acDoc)
  120.                        (setq layerName "E-TREE-TX")
  121.               )
  122.               (foreach attrib (vlax-invoke x 'GetAttributes)
  123.                 (if (= "PD" (vla-get-tagstring attrib))
  124.                   (progn
  125.                     (setq oTreeLabel
  126.                            (vlax-invoke-method
  127.                              oPoints
  128.                              'add
  129.                              (vlax-3d-point pt)
  130.                            )
  131.                     )
  132.                     (vla-put-description
  133.                       oTreeLabel
  134.                       (vl-string-subst
  135.                         "-"
  136.                         " "
  137.                         (vla-get-textstring attrib)
  138.                       )
  139.                     )
  140.                     (vla-put-elevation oTreeLabel (last pt))
  141.                     (vla-put-layer oTreeLabel layerName)
  142.                   )
  143.                 )
  144.               )
  145.             )
  146.            )
  147.          )
  148.  
  149.          ;; point number
  150.          (foreach attrib (vlax-invoke x 'GetAttributes)
  151.            (if (= "PN" (vla-get-tagstring attrib))
  152.              (vl-catch-all-apply
  153.                'vlax-put-property
  154.                (list oPoint 'number (vla-get-textstring attrib))
  155.              )
  156.            )
  157.          )
  158.  
  159.          (vlax-put-property oPoint 'rotation (vla-get-rotation x))
  160.          (vla-delete x)
  161.  
  162.          (setq n (1+ n))
  163.        )
  164.  
  165.        (prompt (strcat "\n** " (itoa n) " block" (if (= 1 n) "" "s") " processed ** "))
  166.  
  167.        (vlax-for x (vlax-get-property aeccDb "PointGroups")
  168.          (vl-catch-all-apply 'vlax-invoke-method (list x 'update))
  169.        )
  170.        (vla-regen acDoc acAllViewports)
  171.      )
  172.   )
  173.  
  174.  
  175.   (*error* nil)
  176. )
  177.  



Cheers
« Last Edit: July 06, 2016, 04:39:15 PM by BlackBox »
"How we think determines what we do, and what we do determines what we get."

sdunn

  • Newt
  • Posts: 90
Re: EaglePoint block to c3d points
« Reply #6 on: July 07, 2016, 11:50:19 AM »
Jeff,

If I remember correctly, they point block can be any name.  The attribute names however, are consistent.

Stacy

sdunn

  • Newt
  • Posts: 90
Re: EaglePoint block to c3d points
« Reply #7 on: July 07, 2016, 12:13:02 PM »
Another drawing containing more variations on points.

BlackBox

  • King Gator
  • Posts: 3770
Re: EaglePoint block to c3d points
« Reply #8 on: July 07, 2016, 02:15:37 PM »
If I remember correctly, they point block can be any name.  The attribute names however, are consistent.

This has been my experience as well; the same code (above) works for my internal surveyor now, as well as an external surveyor at a previous employer (after the block names were updated).


Cheers
"How we think determines what we do, and what we do determines what we get."

Jeff_M

  • King Gator
  • Posts: 4087
  • C3D user & customizer
Re: EaglePoint block to c3d points
« Reply #9 on: July 07, 2016, 04:15:57 PM »
This work's with the 2 dwg's Stacy provided. Note that this will fail when used in drawings which would try to create duplicate point numbers.

Code - Auto/Visual Lisp: [Select]
  1. ;|Routine to convert to a C3D CogoPoint any EaglePoint type point block, meaning any  
  2.   block INSERT which has 3 attributes. Any attribute with a Tag of PN, PD, or ZC will
  3.   be used for the Point Number, RawDescription, and Elevation. The original Insertion
  4.   point, layer, and rotation are also used.
  5.   Authored by: Jeff Mishler 7/7/16
  6. |;
  7.  
  8. (defun c:EP2C3D (/ atts ent idx c3dpt ss *acad* blk c3d c3ddoc pnts)
  9.   ;;borrowed FindNumbers function as posted by MP to the Swamp
  10.   (defun FindNumbers (String / Distil NumList Result)
  11.     (defun Distil (lst)
  12.       (while (eq 46 (car lst)) (setq lst (cdr lst)))
  13.       (setq lst (reverse lst))
  14.       (while (eq 46 (car lst)) (setq lst (cdr lst)))
  15.       (reverse lst)
  16.     )
  17.     (foreach Code
  18.                   (reverse
  19.                     (mapcar
  20.                       '(lambda (Code)
  21.                          (if (or (< 47 Code 58) (eq 46 Code))
  22.                            Code
  23.                            32
  24.                          )
  25.                        )
  26.                       (vl-string->list String)
  27.                     )
  28.                   )
  29.       (if (eq 32 Code)
  30.         (if NumList
  31.           (setq
  32.             Result  (cons NumList Result)
  33.             NumList nil
  34.           )
  35.         )
  36.         (setq NumList (cons Code NumList))
  37.       )
  38.     )
  39.     (mapcar 'vl-list->string
  40.             (vl-remove-if
  41.               'null
  42.               (mapcar 'Distil
  43.                       (if NumList
  44.                         (cons NumList Result)
  45.                         Result
  46.                       )
  47.               )
  48.             )
  49.     )
  50.   )
  51.   (setq C3D (strcat "HKEY_LOCAL_MACHINE\\"
  52.                     (if vlax-user-product-key
  53.                       (vlax-user-product-key)
  54.                       (vlax-product-key)
  55.                     )
  56.             )
  57.         C3D (vl-registry-read C3D "Release")
  58.         C3D (substr
  59.               C3D
  60.               1
  61.               (vl-string-search "." C3D (+ (vl-string-search "." C3D) 1))
  62.             )
  63.         C3D (vla-getinterfaceobject
  64.               *acad*
  65.               (strcat "AeccXUiLand.AeccApplication." C3D)
  66.             )
  67.   )
  68.   (setq C3Ddoc (vla-get-activedocument C3D))
  69.   (setq pnts (vlax-get C3Ddoc 'points))
  70.   (if (setq ss (ssget "x" '((0 . "INSERT") (66 . 1))))
  71.     (progn
  72.       (setq idx -1)
  73.       (while (setq ent (ssname ss (setq idx (1+ idx))))
  74.         (setq atts (vlax-invoke
  75.                      (setq blk (vlax-ename->vla-object ent))
  76.                      'getattributes
  77.                    )
  78.         )
  79.         (if (= 3 (length atts))
  80.           (progn
  81.             (setq c3dPt (vlax-invoke
  82.                           pnts
  83.                           'add
  84.                           (vlax-get blk 'insertionpoint)
  85.                         )
  86.             )
  87.             (vlax-put c3dPt 'rotation (vla-get-rotation blk))
  88.             (vla-put-layer c3dPt (vla-get-layer blk))
  89.             (foreach att atts
  90.               (cond ((eq (vla-get-tagstring att) "PN")
  91.                      (vlax-put c3dPt 'Number (vla-get-textstring att))
  92.                     )
  93.                     ((eq (vla-get-tagstring att) "ZC")
  94.                      (setq elev (findnumbers (vla-get-textstring att)))
  95.                      (if elev
  96.                        (vlax-put c3dPt 'Elevation (atof (car elev)))
  97.                      )
  98.                     )
  99.                     ((eq (vla-get-tagstring att) "PD")
  100.                      (vlax-put c3dPt
  101.                                'rawdescription
  102.                                (vla-get-textstring att)
  103.                      )
  104.                     )
  105.               )
  106.             )
  107.  
  108.             (vla-delete blk)
  109.           )
  110.         )
  111.       )
  112.       (princ
  113.         "\nEagle Point points have been converted to Civil 3D points."
  114.       )
  115.     )
  116.   )
  117.   (princ)
  118. )
  119.  
  120.  

cadtag

  • Swamp Rat
  • Posts: 1152
Re: EaglePoint block to c3d points
« Reply #10 on: July 08, 2016, 07:21:22 PM »
Well, it looks like the people that sent me the EP drawing were mixing some c3d points, along with EP points, and recycling point numbers.  So Jeff's routine worked, but kept failing thanks to that.

I ended up taking the file home, and running it through Carlson w/ Intellicad, and did a straight conversion of EP points to Carlson points, then exported that to a PNEZD text file.  Come Monday, I'll see about slurping that into  the company 2014 C3d.  (My home box only has 2017 installed now - I had to clear space and nuked a bunch of stuff

I suppose if you're the 800lb gorilla in the room, thinking about interoperability with the competition just never gets thought about.  Evn when the competion (EaglePoint) is now no longer competing, but supporting & selling training on c3d.
The only thing more dangerous to the liberty of a free people than big government is big business

BlackBox

  • King Gator
  • Posts: 3770
Re: EaglePoint block to c3d points
« Reply #11 on: July 08, 2016, 09:30:31 PM »
FWIW -

That first code snippet I posted above, exports to PNEZD text file. :-)
"How we think determines what we do, and what we do determines what we get."

Jeff_M

  • King Gator
  • Posts: 4087
  • C3D user & customizer
Re: EaglePoint block to c3d points
« Reply #12 on: July 09, 2016, 11:56:51 AM »
Cadtag, in the case of there being existing CogoPoints, I would've just renumbered them to a starting number higher than any of the EP points, then run my lisp.

BlackBox

  • King Gator
  • Posts: 3770
Re: EaglePoint block to c3d points
« Reply #13 on: July 09, 2016, 12:15:32 PM »
FWIW -

That first code snippet I posted above, exports to PNEZD text file. :-)

For the purposes of clarity, I have a slight correction; the description we use IS the point number, which in turn propagates the Point Groups that we use, for consistency between our survey/engineering departments.

Should the above code need to be modified to actually use the description attribute within the EP Blocks, feel free to modify as needed, or let me know, as it would be an easy change.


Cheers
"How we think determines what we do, and what we do determines what we get."