Author Topic: Name of a drawing (Autocad 2011)  (Read 1609 times)

0 Members and 1 Guest are viewing this topic.

latour_g

  • Newt
  • Posts: 184
Name of a drawing (Autocad 2011)
« on: January 28, 2013, 11:35:57 AM »
Hi,
Is there a way to get only the name of a drawing without having the full path ? Sound easy but I've been searching for quite a while on this..  :-o
Thank you !!
« Last Edit: January 28, 2013, 11:41:21 AM by latour_g »

mohnston

  • Bull Frog
  • Posts: 305
  • CAD Programmer
Re: Name of a drawing (Autocad 2011)
« Reply #1 on: January 28, 2013, 11:50:08 AM »
Use the System.IO.FileInfo object.
It's amazing what you can do when you don't know what you can't do.
CAD Programming Solutions

BlackBox

  • King Gator
  • Posts: 3770
Re: Name of a drawing (Autocad 2011)
« Reply #2 on: January 28, 2013, 12:10:58 PM »
Consider the System.IO.Path.GetFileName() Method:

Code - C#: [Select]
  1. string docNameOnly = Path.GetFileName(doc.Name);
  2.  
"How we think determines what we do, and what we do determines what we get."

latour_g

  • Newt
  • Posts: 184
Re: Name of a drawing (Autocad 2011)
« Reply #3 on: January 28, 2013, 03:48:17 PM »
Perfect ! Thank you mohnston and RenderMan !