Pulsonix User Forum

Technical advice from Pulsonix engineers and the wider community.

 All Forums
 Help with using Pulsonix
 Scripting
 Creating production data from all variants

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON

   Upload a file

Check here to subscribe to this topic.
   

T O P I C    R E V I E W
pdr Posted - 24 May 2018 : 17:22:07
Hi all,

I am trying to create a script that produces all required documents for production.
My first challenge is to create pdf files for the schematics of each available variant.
Each pdf may have multiple schematic pages.

In my example design I have two variants.
I used the Generate Camplots option within pulsonix to create the required plots.
With the script, I enable all camplots that belong to one of the variants and start the plotwriter. I think that this should create one pdf file with the pages of this variant.
Unfortunately, it seems that plotwriter also plots the disabled plots.

This the script:
set PartsInList = Design.Components()
set VariantList = Design.Variants()
set CamPltList = Design.CamPlots()
set PlotWriter = Design.NewPlotWriter()

for each Vari in VariantList
Design.SelectVariant(Vari.Name) '' select this variant
Call GetSchematicInfo(Writer, PartsInList, SchematicPartNr, SchematicFileName, SchematicFound) '' get information from parts in the schematics

for each CamPlt in CamPltList '' enable all plots for this variant (to be grouped in one pdf)
set PlotList = CamPlt.Plots()
if (CamPlt.VariantName = Vari.Name) then
CamPlt.Enabled = True
else
CamPlt.Enabled = False
end if
next

PlotWriter.WriteDevicePlots("PDF")
next

My second problem is that the file created by plotwriter does not use the filename as defined by the plot settings but only the design file name. This causes the script to create two pdf files with the same name, creating a 'file locked' error.

Maybe one of you can help me find a way to solve these problems...
10   L A T E S T    R E P L I E S    (Newest First)
pdr Posted - 21 Sep 2018 : 16:36:24
Hi Jochen,
I tried your suggestion and it works perfectly.
Thank you very much!

There seem to be some 'hidden' features in this scripting ;o)

Jochen Posted - 18 Sep 2018 : 12:59:19
Hi,

i again tried this with the following results:

- If the current variant is <Master Design>, the output is fine with both execution methods
- If the current variant is NOT <Master Design>, the 'scripting calls macro' method fails
- If you add 'Design.SelectVariant("");' to the script before calling the macro, it works.

Jochen
pdr Posted - 31 Aug 2018 : 15:21:29
My last problem still remains.
When I run the (schematic) camplots from script the not fitted components do not show up. When the camplots are run manually, everything is fine.
Any suggestions on how to proceed ?

see attached screenshots

Image Insert:

8.93 KB

Image Insert:

9.05 KB
pdr Posted - 16 Aug 2018 : 15:18:23

I use the last version of Pulsonix
Version 9.1 build 6874


quote:
Originally posted by Jochen

Hi,

i tested that right now and it worked great. No difference between manual / macro / macro in script method.
What version and build of Pulsonix are you using?

Jochen


Jochen Posted - 16 Jul 2018 : 13:38:35
Hi,

i tested that right now and it worked great. No difference between manual / macro / macro in script method.
What version and build of Pulsonix are you using?

Jochen
pdr Posted - 13 Jul 2018 : 12:31:34
Hi Jochen,

Thanks for your reply.
Your comments helps a lot.
I can now start the generation of the cam plots and create the files with the correct filename.

Unfortunately I now run into the next problem.
My designs have multiple variants.
In the variants manager (Setup/variants menu) I selected the option "plot not fitted components".
When I run the camplots macro manually (from pulsonix), the resulting pdf file shows the not fitted components with dashed lines which is correct.
But when I run the macro with the Application.RunMacro command, the resulting pdf file does not show the not fitted components anymore.
Somehow the RunMacro command does not take the "plot not fitted components" setting in account.

Any idea on how to solve this issue?



quote:
Originally posted by Jochen

Hi,

you can try to run a macro that executes the Output / CAM/Plot... / Run dialog.
Before that, configure the current cam plots.

Advantages:
- You can use individual name templates with Application.SetPlotOutputTemplate
- You can combine plots only when wanted by seperately running the macro

Runn a macro with 'RunMacro' command.

The macro looks like
(Pulsonix
(HEADER
(Version 1) )
(Contents "Psx_Macro")
(Context (Type 1) (Doc "CPcbDocument") )
(Settings
(Coords (Design) ) )
(Items
(Command (Name "CAM/Plot") )
(Dialog (Id 25634) (Type Begin) (Value "Initialise") )
(Dialog (Id 25634) (Type End) )
(Dialog (Id 12179) (Type Begin) (Value "Page") )
(Dialog (Id 12179) (Type End) )
(Dialog (Id 25634) (Type Begin) (Value "Control") )
(Dialog (Id 1) (Type Button) (Value "0") (Code 0) )
(Dialog (Id 25634) (Type End) )
(Dialog (Id 25634) (Type Begin) (Value "Cancel") )
(Dialog (Id 25634) (Type End) )
)

Jochen


Jochen Posted - 09 Jul 2018 : 12:49:50
Hi,

you can try to run a macro that executes the Output / CAM/Plot... / Run dialog.
Before that, configure the current cam plots.

Advantages:
- You can use individual name templates with Application.SetPlotOutputTemplate
- You can combine plots only when wanted by seperately running the macro

Runn a macro with 'RunMacro' command.

The macro looks like
(Pulsonix
(HEADER
(Version 1) )
(Contents "Psx_Macro")
(Context (Type 1) (Doc "CPcbDocument") )
(Settings
(Coords (Design) ) )
(Items
(Command (Name "CAM/Plot") )
(Dialog (Id 25634) (Type Begin) (Value "Initialise") )
(Dialog (Id 25634) (Type End) )
(Dialog (Id 12179) (Type Begin) (Value "Page") )
(Dialog (Id 12179) (Type End) )
(Dialog (Id 25634) (Type Begin) (Value "Control") )
(Dialog (Id 1) (Type Button) (Value "0") (Code 0) )
(Dialog (Id 25634) (Type End) )
(Dialog (Id 25634) (Type Begin) (Value "Cancel") )
(Dialog (Id 25634) (Type End) )
)

Jochen
pdr Posted - 09 Jul 2018 : 07:07:01
Hi Steve,
Is there any news on my (two) issues?
I see you refer to log numbers. Is there a way to see an overview of these log items, possibly with expected solved date ?
I would like to continue with my script.


quote:
Originally posted by steve

The first problem is happening because the function WriteDevicePlots will process all the plots of the given type, regardless of whether they happen to be enabled or disabled when you call the function.

This is implied (but not explicitly) in the Help where it says that it will “Generate all the plots for the specified device type”. We would have to log an enhancement request on our system to add an extra function to the PlotWriter object to allow you to override this behaviour and tell the application to use the existing value of the Enabled flag. A suggestion log 44469 has been raised for this.

The second issue, where it seems to be using the wrong file name and gets a file error, sounds like a bug that we need to investigate and resolve. A log has been created 44468.


Pulsonix Assistance

pdr Posted - 25 May 2018 : 10:15:36
Hi Steve,
thanks for your reply.
I am looking forward to getting this solved!
steve Posted - 25 May 2018 : 09:19:30
The first problem is happening because the function WriteDevicePlots will process all the plots of the given type, regardless of whether they happen to be enabled or disabled when you call the function.

This is implied (but not explicitly) in the Help where it says that it will “Generate all the plots for the specified device type”. We would have to log an enhancement request on our system to add an extra function to the PlotWriter object to allow you to override this behaviour and tell the application to use the existing value of the Enabled flag. A suggestion log 44469 has been raised for this.

The second issue, where it seems to be using the wrong file name and gets a file error, sounds like a bug that we need to investigate and resolve. A log has been created 44468.


Pulsonix Assistance