Author Topic: Displaying file name in a menu minus the file extension  (Read 3412 times)

0 Members and 1 Guest are viewing this topic.

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Displaying file name in a menu minus the file extension
« on: June 13, 2005, 09:54:03 AM »
I want to display the filename in a menu pulldown using DIESEL.  I do not want to display the file extension:
Code: [Select]
Building.dwg
I want to display:
Building


I'm using the following to display the filename in the menu:
Code: [Select]
[$(eval,$(getvar,dwgname))]

I can't figure out how to strip the last four characters off.  SUBSTR displays an error:
Code: [Select]
[$(eval,$(-,$(substr,$(getvar,dwgname)),4))]
Displays:$(-,??))


Any ideas?

daron

  • Guest
Displaying file name in a menu minus the file extension
« Reply #1 on: June 13, 2005, 10:33:01 AM »
Is there a strlen in DIESEL?

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Displaying file name in a menu minus the file extension
« Reply #2 on: June 13, 2005, 10:34:46 AM »
$(eval,$(substr,$(getvar,dwgname),1,$(-,$(strlen,$(getvar,dwgname)),4)))
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Displaying file name in a menu minus the file extension
« Reply #3 on: June 13, 2005, 10:37:08 AM »
Quote from: MP
$(eval,$(substr,$(getvar,dwgname),1,$(-,$(strlen,$(getvar,dwgname)),4)))

Excellent! Thank you very much.  Final code:
Code: [Select]
[$(eval,Current Floor :\t$(substr,$(getvar,dwgname),1,$(-,$(strlen,$(getvar,dwgname)),4)))]

daron

  • Guest
Displaying file name in a menu minus the file extension
« Reply #4 on: June 13, 2005, 10:37:14 AM »
I was just going to say that there is. Thanks MP.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Displaying file name in a menu minus the file extension
« Reply #5 on: June 13, 2005, 10:42:11 AM »
MY pleasure folks.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Displaying file name in a menu minus the file extension
« Reply #6 on: June 13, 2005, 11:35:30 AM »
I was trying to use substr , but I didn't have strlen in there.  Then I tried strlen with no substr.  Didn't try putting them together.  Don't think I would have figured out that format of them together.  Thanks again :twisted:

daron

  • Guest
Displaying file name in a menu minus the file extension
« Reply #7 on: June 13, 2005, 11:44:24 AM »
You would use the same format and pattern for lisp.

Amsterdammed

  • Guest
Displaying file name in a menu minus the file extension
« Reply #8 on: June 14, 2005, 08:40:46 AM »
(vl-filename-base (getvar "dwgname"))

would be easier

Bernd

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Displaying file name in a menu minus the file extension
« Reply #9 on: June 14, 2005, 10:05:20 AM »
Of course it would, but he asked for diesel.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Displaying file name in a menu minus the file extension
« Reply #10 on: June 14, 2005, 10:58:57 AM »
Quote from: Amsterdammed
(vl-filename-base (getvar "dwgname"))

would be easier

Bernd


But could that be used in a menu name for display purposes?

daron

  • Guest
Displaying file name in a menu minus the file extension
« Reply #11 on: June 14, 2005, 11:06:19 AM »
Not in an LT environment and possibly not in a regular environment either. :?:

Amsterdammed

  • Guest
Displaying file name in a menu minus the file extension
« Reply #12 on: June 15, 2005, 02:59:29 PM »
Quote
You would use the same format and pattern for lisp.


MP, you are right,


I was replying on Darons post

Bernd