TheSwamp

Code Red => .NET => Topic started by: latour_g on January 28, 2013, 11:35:57 AM

Title: Name of a drawing (Autocad 2011)
Post by: latour_g 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 !!
Title: Re: Name of a drawing (Autocad 2011)
Post by: mohnston on January 28, 2013, 11:50:08 AM
Use the System.IO.FileInfo object.
Title: Re: Name of a drawing (Autocad 2011)
Post by: BlackBox on January 28, 2013, 12:10:58 PM
Consider the System.IO.Path.GetFileName() (http://msdn.microsoft.com/en-us/library/system.io.path.getfilename.aspx) Method:

Code - C#: [Select]
  1. string docNameOnly = Path.GetFileName(doc.Name);
  2.  
Title: Re: Name of a drawing (Autocad 2011)
Post by: latour_g on January 28, 2013, 03:48:17 PM
Perfect ! Thank you mohnston and RenderMan !