What's new

WizoScript -- General Questions

RCH_Projects

Alibre Super User
Thank you Ajayre for the clarification!

If alligators weren't snapping at my butt all the time I would be more useful and pick up Python for real.
 

ajayre

Alibre Super User
RCH_Projects said:
If alligators weren't snapping at my butt all the time

Is this you? :D

hqdefault.jpg
 
RCH_Projects said:
Is this like your first python programming effort? :wink:
Roger -- It's more like the old Johnny Cash song I'm Being Eaten by a Boa Constrictor. What passes as my "background in programming" dealt more with activating or deactivating solenoids based on interrupt signals (using PL/1 or FORTH) back in the early-1970's.
 

RCH_Projects

Alibre Super User
Lew_Merrick said:
RCH_Projects said:
Is this like your first python programming effort? :wink:
Roger -- It's more like the old Johnny Cash song I'm Being Eaten by a Boa Constrictor. What passes as my "background in programming" dealt more with activating or deactivating solenoids based on interrupt signals (using PL/1 or FORTH) back in the early-1970's.

Ah, yes.

Baytown, Texas had the (now) Exxon refinery in it's tax base. Therefore in High School I had access to a vocational school which included a Cincinnati Milacron terminal (http://microship.com/cincinnati-milacron-george-your-first-computer/ -monitor, -floppy, +card reader, +modem) hooked up with Region 4 for education for punch card batch programming. Booted it with a 6 inch stack of unmarked 80 column cards that one student (after my graduation) dropped, shutting them down for a week or so until a new boot deck was supplied . This shared space and cooling with the school district Honeywell 200 (http://alegion63.tripod.com/bob/id6.html an irritated programmer once kicked it and shut it right down) that I operated for a year while assisting programming post graduation.

In high school we learned Fortran, RPG and COBOL in the late 70'S. In the community college I most enjoyed APL (A programming Language) which was very low level ("assembly code"). I enjoyed pushing or popping a stack and Reverse Polish Notation. Fond memories.
 

hide

New Member
WizoScript Suppress parts

Hi,

I would like to export each part to STL-format files in assembly by means of Wizo-script because of many parts in the assembly file.
The way to export each part manually is exporting the parts after suppressing the other parts.
So I would like to know the way to suppress parts in Wizo-script.
Does anyone know the way ?
(I found SuppressFeature in Reference manual, which suppresses not a part but a feature on the part)

Best
Hide
 

ajayre

Alibre Super User
Re: WizoScript Suppress parts

hide said:
Hi,

I would like to export each part to STL-format files in assembly by means of Wizo-script because of many parts in the assembly file.
The way to export each part manually is exporting the parts after suppressing the other parts.
So I would like to know the way to suppress parts in Wizo-script.
Does anyone know the way ?
(I found SuppressFeature in Reference manual, which suppresses not a part but a feature on the part)

Best
Hide

Here is how to get access to all parts in an assembly (and subassemblies): http://www.wizotools.com/2016/05/31/lis ... ssemblies/

The second to last line of this script shows how to export a part as STL: http://www.wizotools.com/2016/05/31/hex-head-bolt/

Put the two together and you can export all parts in in an assembly as STL.

There isn't a way to determine if a part is suppressed or not, so you will have to delete the unneeded STLs after export.

Andy
 

hide

New Member
Re: WizoScript Suppress parts

ajayre said:
hide said:
Hi,

I would like to export each part to STL-format files in assembly by means of Wizo-script because of many parts in the assembly file.
The way to export each part manually is exporting the parts after suppressing the other parts.
So I would like to know the way to suppress parts in Wizo-script.
Does anyone know the way ?
(I found SuppressFeature in Reference manual, which suppresses not a part but a feature on the part)

Best
Hide

Here is how to get access to all parts in an assembly (and subassemblies): http://www.wizotools.com/2016/05/31/lis ... ssemblies/

The second to last line of this script shows how to export a part as STL: http://www.wizotools.com/2016/05/31/hex-head-bolt/

Put the two together and you can export all parts in in an assembly as STL.

There isn't a way to determine if a part is suppressed or not, so you will have to delete the unneeded STLs after export.

Andy

Hi, Andy
Thanks for guiding me correctly. I thought that I need to suppress each part before exporting.
I just added one-line P.ExportSTL('') as follows

Thanks again
Hide

Code:
# list all the parts in an assembly and it's sub-assemblies
def ListPartsinAssembly(Assem):
  for P in Assem.Parts:
    print "%s in %s" % (P, Assem)
    P.ExportSTL('C:/temp/'+P.Name+'.stl')

  for SA in Assem.SubAssemblies:
    ListPartsinAssembly(SA)
 
# top-level assembly
Assem = Assembly(r'C:\Users\Andy\Documents\JacktheRipperBot\Parts\Source', 'JacktheRipperBot.AD_ASM')
ListPartsinAssembly(Assem)
Assem.Close()
 
Hi Andy -- You have "suggested" that there is a way around using the "double backslash" ("\\") when defining file paths in WizoScript." I am using Wizo V 4.36 (build 770) and am failing miserably at using "single backslash" ("\") file paths. Do you have anything that might teach me what I am doing wrong? [Irrational minds want to know!]
 

oldfox

Alibre Super User
Lew, I use WizoScripts examples as templates and then change them for my own use.
The item in question here is the *path*. From the "EarthGears' example Andy's path is:
OutputFolder = 'C:/Users/Andy/Documents/EarthArm/Scratch/' -- verbatim

All I do is change path to "C:/Users/myusername/Desktop/" and then anything that was pointed to Andy's file will go to my desktop
and I can handle accordingly. NOTE the change from SINGLE quotes to DOUBLE quotes. Python will see this and error to the console.
This will remind you to change that. Hope this helps.
 
=>> OutputFolder = 'C:/Users/Andy/Documents/EarthArm/Scratch/' -- verbatim

Interesting, when I try that (reading the file path value from an xlsx spreadsheet it fails!
 
Andy nn -- What I am trying to accomplish is to have the user load a filepath into a given cell of a given worksheet in an xlsx spreadsheet and use that (Project) filepath to save a (if you will) generated Part file. I would be losing my mind (except that is way too late for that)!
 

ajayre

Alibre Super User
This works for me:

1. Create a new empty workbook in Excel 2013.
2. In cell A1 enter 'P:\temp\'
3. In cell B1 enter 'Foo'
4. Save to P:\temp\ExcelPathTest.xlsx
5. Run the script:

Code:
from openpyxl import load_workbook
 
# open a workbook
wb = load_workbook(filename = 'P:\\temp\\ExcelPathTest.xlsx')
 
# get access to the sheet
Sheet1 = wb['Sheet1']
 
# get the value in cells
Folder = Sheet1['A1'].value
Name = Sheet1['B1'].value

P = Part(Name)
P.SaveAs(Folder, Name)

An empty part is created and saved to P:\temp\Foo.AD_PRT.

Andy
 
Hi Andy -- What I found as "different" from what you posted is:

Your code has the line: wb = load_workbook(filename = 'P:\\temp\\ExcelPathTest.xlsx')

Whereas my code had to have the line: wb = load_workbook(filename = "J:\\Lews_Data\\Designs\\Gxd\\Andy Ayre\\Lessons Learned Docs\\PathTest.xlsx", data_only=True) to work. My WizoScript is dated 2017/12/11.
 
To be clear, I copy the file path from the "top cell" of the Windows Explorer which does not include the closing backslash ('\') of the file path string. Therefore I use a concatenate command to add the "closing backslash" to the file path string. Without the "data_only = True" modifier I only get an "=Concatenate()" string out of the spreadsheet.
 
Top