Author Topic: retrieve the names of Civil-corridors from database  (Read 1174 times)

0 Members and 1 Guest are viewing this topic.

Peter2

  • Swamp Rat
  • Posts: 650
retrieve the names of Civil-corridors from database
« on: August 02, 2017, 12:40:29 PM »
The question is 95% the same as here:
retrieve the names of Civil-surfaces from database
https://www.theswamp.org/index.php?topic=53271.0


It seems that the way to get the corridors (as object) is the third way (beside getting alignments and getting surfaces). So -

How to get the corridors (plus names) via Lisp?

Have a fine evening!
Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23

Jeff_M

  • King Gator
  • Posts: 4094
  • C3D user & customizer
Re: retrieve the names of Civil-corridors from database
« Reply #1 on: August 02, 2017, 01:29:59 PM »
You need to use the RoadwayApplication...

Code - Auto/Visual Lisp: [Select]
  1. (defun getRoadApp (/ *acad* C3D)
  2.            (setq C3D (strcat "HKEY_LOCAL_MACHINE\\"
  3.                              (if vlax-user-product-key
  4.                                (vlax-user-product-key)
  5.                                (vlax-product-key)
  6.                              )
  7.                      )
  8.                  C3D (vl-registry-read C3D "Release")
  9.                  C3D (substr
  10.                        C3D
  11.                        1
  12.                        (vl-string-search
  13.                          "."
  14.                          C3D
  15.                          (+ (vl-string-search "." C3D) 1)
  16.                        )
  17.                      )
  18.                  C3D (vla-getinterfaceobject
  19.                        (vlax-get-acad-object)
  20.                        (strcat "AeccXUiRoadway.AeccRoadwayApplication." C3D)
  21.                      )
  22.            )
  23.       )
  24.     C3D
  25.   )
  26. )
  27.  
  28. (setq roadapp (getRoadapp)
  29.       Roaddoc (vlax-get roadapp 'activedocument)
  30.       corridors (vlax-get Roaddoc 'Corridors))
  31.  
  32. (vlax-for c corridors
  33.   (setq names (cons (vlax-get c 'name) names))
  34.   )
  35.  

Peter2

  • Swamp Rat
  • Posts: 650
Re: retrieve the names of Civil-corridors from database
« Reply #2 on: August 03, 2017, 03:21:21 AM »
Great. Thanks a lot!  :yay!:

Edit:
I browsed through this documents:
http://docs.autodesk.com/CIV3D/2018/ENU/API_Reference_Guide/html/e7b1fa34-671e-acd5-7f56-5f97d04c1494.htm

Am I too blind to find the information which Application (Roadway, Land, Pipe, ..) has to be used?
« Last Edit: August 03, 2017, 03:39:16 AM by Peter2 »
Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23

Jeff_M

  • King Gator
  • Posts: 4094
  • C3D user & customizer
Re: retrieve the names of Civil-corridors from database
« Reply #3 on: August 03, 2017, 11:10:15 AM »
This is what I use to get the desired application:
Code - Auto/Visual Lisp: [Select]
  1. (defun getaeccApp (module / *acad* C3D) ;; module must be "Land", "Pipe", "Roadway", or "Survey"
  2.            (setq C3D (strcat "HKEY_LOCAL_MACHINE\\"
  3.                              (if vlax-user-product-key
  4.                                (vlax-user-product-key)
  5.                                (vlax-product-key)
  6.                              )
  7.                      )
  8.                  C3D (vl-registry-read C3D "Release")
  9.                  C3D (substr
  10.                        C3D
  11.                        1
  12.                        (vl-string-search
  13.                          "."
  14.                          C3D
  15.                          (+ (vl-string-search "." C3D) 1)
  16.                        )
  17.                      )
  18.                  C3D (vla-getinterfaceobject
  19.                        (vlax-get-acad-object)
  20.                        (strcat "AeccXUi" module ".Aecc" (if (= (strcase module) "LAND") "" module) "Application." C3D)
  21.                      )
  22.            )
  23.       )
  24.     C3D
  25.   )
  26. )
  27.  

Corridors are in the Roadway application.