Lisp getfiled command

Hello

Here's a little riddle, can you help me solve it?

See attachment for confirmation

Explanations:

- I create a pathcible variable to store the path "H:\\cad2014\\"

- I store in the fcible variable the result of the getfiled function

Test 1, for the choice of the file A_BSM.txt the fcible variable gives me "A_BSM.txt"

Try 2, for the choice of the file F000d_ADEMOLIR.txt the fcible variable gives me "F000d_ADEMOLIR.txt"

All the files give me a similar answer, i.e. the name of the file except,

Test 3, for the choice of the file A000d_ADEMOLIR.txt the fcible variable gives me "H:\\cad2014\\A000d_ADEMOLIR.txt"

which implies an error for the rest of the program on this file?

In reality, the file of trial 2 is identical to trial 3, it is a copy of the file A000d_ADEMOLIR.txt, renamed?

The question I'm asking myself is about the result of the getfiled function, should it:

- give me the name of the file only?

- give me the path and name of the file?

Thanks  in advance

jplunus


2019-10-17_15h02_52.png

According to this page (getfilled help), I would look at the last parameter ("8").

1 Like

stefbeno, thank you

The problem comes from the parameter, but  it's the ("8") that I should use.

8 (bit 3) - If this bit is set and bit 0 is not set, 
getfiled performs a library lookup for the file name entered.
If it finds the file and its directory in the library's search 
path, it deletes it and returns only the file name.
(It doesn't delete the path if it detects that a file with the same 
name is in a different directory.)
If this bit is not set, getfiled returns the full file name, 
including the path.
Set this bit if you are using the dialog box to open an 
existing file whose name you want to save in the drawing 
(or another database).

- I looked at properties without  success

- I replaced the A with a, same problem

-I replaced the A by X, no more problem 

I give up and solve the problem by introducing a condition that follows

(if (= pathcible (substr fcible 1 11) (setq fcible (substr fcible 12)))

That way, whether or not the function inserts the path my result will always be the same

and the routine will no longer be blocked.

A+