Author Topic: can I get a station and elevation from Civil 3D using lisp  (Read 3695 times)

0 Members and 1 Guest are viewing this topic.

Tortiz

  • Guest
can I get a station and elevation from Civil 3D using lisp
« on: April 23, 2015, 12:57:51 PM »
I have an old lot grading program I wrote a long time ago. the boss has asked me to update it to work with civil 3D. I need to pick a point and pull an alignment station and proposed profile elevation. Can I do this with lisp or do I have to use NET to do it.

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: can I get a station and elevation from Civil 3D using lisp
« Reply #1 on: April 23, 2015, 01:30:16 PM »
I believe that this can be done in lisp. By picking an alignment you can get the associated profiles. The alignment has the StationOffset(e, n) method and the Profile has the ElevationAt(station) method.

Tortiz

  • Guest
Re: can I get a station and elevation from Civil 3D using lisp
« Reply #2 on: May 01, 2015, 09:04:52 AM »
Finally got around to get the grading program up to date. thank for the information. :-)

Tortiz

  • Guest
Re: can I get a station and elevation from Civil 3D using lisp
« Reply #3 on: May 07, 2015, 10:30:23 AM »
After showing the powers that be the updated lot grading program. The comment that came back is that they want to create a Civil 3d surface. The program is in VLISP. I don't think you can create feature lines in lisp.  I was thinking of creating a NET program to take the data the grading program creates and create feature lines. I'd like to redo the hole thing in net but time does not allow. I never tide lisp data to a NET program before. Any comments or ideas on how to approach?

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: can I get a station and elevation from Civil 3D using lisp
« Reply #4 on: May 07, 2015, 11:23:04 AM »
You don't need featurelines for a surface. You can add  featurelines from polylines to a Site using lisp. I won't try to dissuade you from converting it to .NET, as that is the preferred method of working with C3D now. However, since time is critical, you may want to stick with lisp for now. If you share your code, or at least the portions that need attention, we could probably have you up & running fairly quickly.

Here's a quick example of adding a featureline...no error checking, not optimized, just a quick example.
Code - Auto/Visual Lisp: [Select]
  1.     (setq *acad* (vlax-get-acad-object))
  2.     (setq C3D (strcat "HKEY_LOCAL_MACHINE\\" (if vlax-user-product-key (vlax-user-product-key) (vlax-product-key) ) )
  3.       C3D (vl-registry-read C3D "Release")
  4.       C3D (substr C3D 1 (vl-string-search "." C3D (+ (vl-string-search "." C3D) 1) ) )
  5.       C3D (vla-getinterfaceobject *acad* (strcat "AeccXUiLand.AeccApplication." C3D) )
  6.       )
  7.  
  8.     (setq ent (car (entsel)));;select a polyline; lw, 2d, or 3d
  9.     (setq civdoc (vlax-get c3d 'activedocument))
  10.     (setq sites (vlax-get civdoc 'sites))
  11.     (setq site (vlax-invoke sites 'add "Grading"));;creates the Grading site, use a non-existent name for this, other wise get the correct Site
  12.     (setq flines (vlax-get site 'featurelines))
  13.     (setq fline (vlax-invoke flines 'addfrompolylineex (vlax-ename->vla-object ent) "Basic"));;the Style name must exist
  14.  

Tortiz

  • Guest
Re: can I get a station and elevation from Civil 3D using lisp
« Reply #5 on: May 07, 2015, 12:29:32 PM »
Thanks Jiff, let me give it a shot and I'll post something on Monday.

HOSNEYALAA

  • Newt
  • Posts: 103
Re: can I get a station and elevation from Civil 3D using lisp
« Reply #6 on: April 19, 2020, 10:31:18 AM »
You don't need featurelines for a surface. You can add  featurelines from polylines to a Site using lisp. I won't try to dissuade you from converting it to .NET, as that is the preferred method of working with C3D now. However, since time is critical, you may want to stick with lisp for now. If you share your code, or at least the portions that need attention, we could probably have you up & running fairly quickly.

Here's a quick example of adding a featureline...no error checking, not optimized, just a quick example.
Code - Auto/Visual Lisp: [Select]
  1.     (setq *acad* (vlax-get-acad-object))
  2.     (setq C3D (strcat "HKEY_LOCAL_MACHINE\\" (if vlax-user-product-key (vlax-user-product-key) (vlax-product-key) ) )
  3.       C3D (vl-registry-read C3D "Release")
  4.       C3D (substr C3D 1 (vl-string-search "." C3D (+ (vl-string-search "." C3D) 1) ) )
  5.       C3D (vla-getinterfaceobject *acad* (strcat "AeccXUiLand.AeccApplication." C3D) )
  6.       )
  7.  
  8.     (setq ent (car (entsel)));;select a polyline; lw, 2d, or 3d
  9.     (setq civdoc (vlax-get c3d 'activedocument))
  10.     (setq sites (vlax-get civdoc 'sites))
  11.     (setq site (vlax-invoke sites 'add "Grading"));;creates the Grading site, use a non-existent name for this, other wise get the correct Site
  12.     (setq flines (vlax-get site 'featurelines))
  13.     (setq fline (vlax-invoke flines 'addfrompolylineex (vlax-ename->vla-object ent) "Basic"));;the Style name must exist
  14.  

MR Jeff_M
Thank you very much
This I was looking for a lot
Thanks for what he offered to help others