Subject:
|
Re: Seams like a problem
|
Newsgroups:
|
lugnet.cad.dev
|
Date:
|
Thu, 12 Oct 2000 02:57:23 GMT
|
Viewed:
|
905 times
|
| |
| |
"Lars C. Hassing" <lch@ccieurope.com> wrote in message
news:G2AJCw.K6u@lugnet.com...
> Dave Schuler wrote..
> > In lugnet.cad.dev, Lars C. Hassing writes: [SNIP]
> So. The solution would be to detect whether the opened model
> is actually a part from PARTS. This is, I believe, not so easy:
> 1) If you are in MODELS and run "l3p ..\parts\3001", how do you
> detect that the 3001.dat is in the LDRAWDIR\PARTS ?
> 2) LDRAWDIR is set using 8+3 names, and the path to the selected
> model may use long names (L3Lab only)
> If you have solutions to this, please let me know.
Well, I don't think it's trivial, but it is definitely possible. First grab
the path portion of the command line (if there is one; if not just use the
current directory path in its place).
Next, you need to determine if the path is relative or absolute. I would
suggest first replacing any '/' characters with '\' (remember, Windows does
allow '/' to be used as a path separator, even though it is extremely rare.)
If its first character is '.', it's definitely relative, so append it to the
current directory to create an absolute path. If the first character is
'\', and the second character isn't, it is semi-absolute; append it to the
current drive letter. If the first two characters are "\\", you know that
they won't match LDRAWDIR if you are requiring LDRAWDIR to be an 8.3 path,
since this is a UNC path. If the second character is not ':', it is
relative, so append it to the current directory. (There are various path
functions that could be used instead of much of the above in Library help
under Platform SDK->User Interface Services->Shell and Common
Controls->Windows Shell API->Shell Utility API's->Path Functions.) Once you
have an absolute path, call PathCanonicalize to get rid of all the .'s and
..'s.
An alternate way is to change to the directory containing the model file
specified on the command line (which do anyway in order to be able to load
any dat files referenced by the model), and then just use the current
directory in place of all the stuff in the preceding paragraph.
Next, call GetShortPathName on the result to get the 8.3 version of the
path. You can then compare this to %LDRAWDIR%\parts to determine if the
file specified is a part. Note that I haven't actually done any of this
yet, but I would think it would work.
--Travis Cobbs (tcobbs@san.REMOVE.rr.com)
|
|
Message has 1 Reply: | | Re: Seams like a problem
|
| Travis Cobbs wrote... (...) Agreed - and you have to implement it on all platforms. Thanks for the thorough description. It resembles my thoughts. /Lars (24 years ago, 12-Oct-00, to lugnet.cad.dev)
|
Message is in Reply To:
| | Re: Seams like a problem
|
| Dave Schuler wrote.. (...) Well, I think you have struck a problem in L3P/L3Lab that I have been aware of for quite a while! The problem is when you select a part from PARTS to render/view. The model file (here the part) specified on the command (...) (24 years ago, 11-Oct-00, to lugnet.cad.dev)
|
16 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|