What's new

WizoScript -- General Questions

ajayre

Alibre Super User
I haven't changed anything in v4.40 regarding that. Please post a trivial example demonstrating the problem.
 
Andy -- Before I logged on I created a zip file with the Script and the Part dataset associated with it. I hope this will do.
 

Attachments

  • Fillister Head Length.zip
    87.4 KB · Views: 5
Andy -- Sorry that I am so dense. I am creating a rather large application set to design and construct "O-Ring Glands" (Shaft, Bore, and Face) in accordance with SAE and MIL-Spec requirements. In essence, there is a spreadsheet where the O-Ring size is selected and the Gland is designed. Then a set of Part Models are "adjusted" (through Equation Editor values) and Saved and Renamed into a user's Project Directory. My intent is that the Project Directory Path can be copied from the Windows Explorer directly into a spreadsheet cell to make the definition. What I need is a simple (and saveable) guide as to how I can make this happen. The net result of this operation set is to Save (into the Project Directory) (1) a Part that creates a Deformed O-Ring to identify everything correctly and (2) a BOOLEAN Subtract Part that will create the appropriate O-Ring Gland. [A copy of the spreadsheet should also be renamed and saved into the Project Directory to document the design decisions.]

So, I need the Idiot's Guide as to how to accomplish this!
 

ajayre

Alibre Super User
In Windows Explorer if you click in the box where the folder name is shown, e.g. "Foo > Bar > Baz" it will change into a regular path, e.g. "C:\foo\bar\baz" that you can copy with Ctrl-C and then paste into a spreadsheet cell with Ctrl-V.

Andy
 
In Windows Explorer if you click in the box where the folder name is shown, e.g. "Foo > Bar > Baz" it will change into a regular path, e.g. "C:\foo\bar\baz" that you can copy with Ctrl-C and then paste into a spreadsheet cell with Ctrl-V.
Yes, I understand and use that with great regularity (though the final '\' is omitted). When I add the "final '\' by concatenation" if fails when "passed" to a WizoScript code set. You keep telling me this should work, but I have yet to find a way to make that happen -- which is why I need the "Idiot's Guide" version.
 
Good Morning Lee
Please forgive my poor englisch.
I think i have 2 simple solutions for your need

1) using pipe function in wondows, just open console, go to directory , and write this command "dir > dir.csv". You will get a csv file with the content of the directory
2) using the one of the batch file, one for getting a csv file and the other is a SQL file i use in a web site.

last year i made a php script in order to get the infor directly from a directory, due special character and differents character set i decided to use the bach file and upload the SQL info in the database
I hope this will help you
 

Attachments

  • DirYear.zip
    110.7 KB · Views: 0
Andy -- My question is, "What am I doing wrong?" If I have the path (say) "J:\Lews_Data\Designs\Alibre_Standards\O-Ring Basis\" in cell (say) "$'System Values'.$B$5" and I load it (and a File Name) into a WizoScript, it hangs and fails every time. But, if I change the path to "J:\\Lews_Data\\Designs\\Alibre_Standards\\O-Ring Basis\\" it works every time.

My "issue" is that my "Alibre Standards" directory set is something that has "evolved" since the 1970's and is (shall we say) unlikely to be duplicated by a :modern user." [Each of the Libraries I distribute has a rather detailed (and, I am surre boring) section on creating such a "directory set" for the user.] Thus, my preference (since the mid-1980's) has been to use the File Exploprer's Path Collector to copy the appropriate File Path into a specific Spreadsheet/Worksheet Cell Location and, using the Concatenate command, complete the definition to make (historically) Hyperlink commands work.

I have been doing things this way since 1983 when Sean Thornhill created the foundation of the modern spreadsheet program. That does not make my approach right, but I am thoroughly canonized to this process. Should I need to learn a new approach, I will, but I have 35 years worth of calcification to overcome.
 

GIOV

Alibre Super User
Hi.
it's avery interesting topic but please for future easy forum search WizoScript is into the following section:
Other 3rd party Add-ons
Thanks very much:)
Giov
 

simonb65

Alibre Super User
Andy -- My question is, "What am I doing wrong?" If I have the path (say) "J:\Lews_Data\Designs\Alibre_Standards\O-Ring Basis\" in cell (say) "$'System Values'.$B$5" and I load it (and a File Name) into a WizoScript, it hangs and fails every time. But, if I change the path to "J:\\Lews_Data\\Designs\\Alibre_Standards\\O-Ring Basis\\" it works every time.
As per my original post, get the script to validate the path entered in your excel sheet. i.e. Add missing trailing '\' and if they are single '\', replace them with "\\" BEFORE passing them to the load function! If you write scripts that don't validate data in ... I'm afraid you'll get crap out or the script will fail (as you are finding!)
 
Simon -- I am distributing these Libraries moderately widely. One of the aspects is that the Parts created by them need to be (named) and stored in Project Directories -- something I have enough trouble trying to explain to (relatively novice) users and I try to simplify things for them to the greatest degree possible. I find it hard to believe that a "solution to this problem" has not already been developed.
 

simonb65

Alibre Super User
Lew, most scripting languages are raw building blocks with no single application in mind. To use them (and its the same for all programming/scripting languages) you have to glue those functions together and validate data specific to your end application. What you are trying to achive is not unachievable, it just needs a little engineering. As Andy is the python guru, he is the best person to maybe create the lines of code that I hint at. If you were writing in C, C++, Basic, Pacal, Fortran, PHP, C# or assembler ... I would provide the code ,you need to solve your problem :)
 
Simon -- I was a "reasonably decent" coder back in the 19701's (FORTH, BCPL, and even very early C). You use it or you lose it (and yes, I've lost it). Python would drive me nuts (but it is way too late for that). Trying to guess when it needs to be .Value rather than .value keeps me running in circles. My (this instant) current crisis is a line of code (Gland_ID = "a_a0_Gland_ID") generating this:

File "", line 102
Gland_ID = "a_a0_Gland_ID"
SyntaxError: unexpected token 'Gland_ID'

as an error message. It makes no sense to me -- yet I keep charging the machine gun lines with my bayonet...
 

ajayre

Alibre Super User
If I have the path (say) "J:\Lews_Data\Designs\Alibre_Standards\O-Ring Basis\" in cell (say) "$'System Values'.$B$5" and I load it (and a File Name) into a WizoScript, it hangs and fails every time. But, if I change the path to "J:\\Lews_Data\\Designs\\Alibre_Standards\\O-Ring Basis\\" it works every time.

Here you posted you have it working with concatenation in Excel: https://www.alibreforum.com/forum/i...pt-general-questions.19278/page-2#post-125808

There are no double-backslashes used. What is different now?

If you don't want to use Excel's concatenate function then to implement Simon's suggestion change your working script from that post:

Code:
FPath = NameSht['B3'].value + r'\'

where B3 contains the path with single backslashes and no trailing backslash.

If your problem is because of reading cell contents vs formulas then in your script you could open the spreadsheet twice, the first time to read one type of value, close it, then reopen to read the other type. The user running the script won't know or care you are doing this.

Andy
 

simonb65

Alibre Super User
Not being a Python man, I would have used ...

Code:
FPath = NameSht['B3'].value
if FPath.endswith(r'\') == FALSE:
    FPath = FPath + r'\'

this would add the trailing backslash if the user didn't put it in the file path in the spreadsheet cell.

Just a stab in the dark on the double backslashes ...

Code:
// first convert any double slashes in the file path to singles
FPath = string.replace(FPath , "\\\\", "\\")

// at this point, all slashes in the file path should just be singles. So, now convert them all to doubles
FPath = string.replace(FPath , "\\", "\\\\")

// use the validated FPath in your code
...

... this ensures that if you have a mixed path in the spreadsheet, i.e. c:\\a\b\\c\\d\e, it converts to c:\a\b\c\d\e then c:\\a\\b\\c\\d\\e. If you just convert all singles to doubles straight away with the first example, you get c:\\\\a\\b\\\\c\\\\d\\e !!! not good :eek:

Now, as I said, i'm not a Python man, but this is the route you need to go down to validate and accept any format of file path in the spreadsheet.
 
If your problem is because of reading cell contents vs formulas then in your script you could open the spreadsheet twice, the first time to read one type of value, close it, then reopen to read the other type. The user running the script won't know or care you are doing this.
And, quite a while ago, I asked you if there was a "close" command for spreadsheets. Your answer (with respect to WizoScript) was "No." Has this changed? When I started coding, it was exceptionally "poor form" to open a file and not close it. Irrational minds want to know...

Also, do you have any comments or suggestions with respect to my #77 posting here?

TIA
 
Top