-40%
Le deal à ne pas rater :
Tefal Ingenio Emotion – Batterie de cuisine 10 pièces (induction, ...
59.99 € 99.99 €
Voir le deal
Le deal à ne pas rater :
Jeux, jouets et Lego : le deuxième à -50% (large sélection)
Voir le deal

Cambam : VB Script : Groups d'usinage

2 participants

Aller en bas

Cambam : VB Script : Groups d'usinage Empty Cambam : VB Script : Groups d'usinage

Message  Strofe Dim 8 Oct 2017 - 21:17

Bonjour

Je prépare un projet et je souhaite créer des groupes d'usinages qui vont eux-mêmes contenir des poches avec des polylines qui sont placés dans différents claques (layer).

Comment créer un groupe d'usinage, le nommer et créer le nom de fichier GCode ?

Merci pour les pistes qui vont m'aider à accomplir mon projet.

Bonne soirée

Christophe
Strofe
Strofe
je prends du galon
je prends du galon

Messages : 89
Points : 129
Date d'inscription : 07/04/2012
Age : 55
Localisation : BEAUVAIS (OISE)

http://strofe.sonneck.fr/

Revenir en haut Aller en bas

Cambam : VB Script : Groups d'usinage Empty Re: Cambam : VB Script : Groups d'usinage

Message  Strofe Dim 8 Oct 2017 - 21:38

Bonsoir

Je creuse, je creuse.

Code:
 Dim all_parts As CamBam.CAM.CAMParts
 Dim prt As CamBam.CAM.CAMPart
 
 all_parts = view.CADFile.Parts

 For Each prt In all_parts
 app.log(prt.Name)
 Next

C'est l'objet CAMParts qui m'intéresse. Comment trouver ses méthodes et propriétés ??

A+
Strofe
Strofe
je prends du galon
je prends du galon

Messages : 89
Points : 129
Date d'inscription : 07/04/2012
Age : 55
Localisation : BEAUVAIS (OISE)

http://strofe.sonneck.fr/

Revenir en haut Aller en bas

Cambam : VB Script : Groups d'usinage Empty Re: Cambam : VB Script : Groups d'usinage

Message  dh42 Dim 8 Oct 2017 - 22:39

Salut,

Je regarde ça ... ça peut prendre un moment, je n'ai jamais fait de groupe par programmation.

++
David

_________________
Traduction Française de CamBam et de sa documentation.
dh42
dh42
Admin
Admin

Messages : 25132
Points : 37848
Date d'inscription : 21/06/2009
Age : 60
Localisation : Près de St Etienne (42)

http://dh42.free.fr/

Revenir en haut Aller en bas

Cambam : VB Script : Groups d'usinage Empty Re: Cambam : VB Script : Groups d'usinage

Message  dh42 Dim 8 Oct 2017 - 22:41

Alors j'ai retrouvé un bout de code que j'avais fait qui permet de lister le nom des Groupes existants.

Code:
sub main

        Dim ui As CamBamUI = CamBam.UI.CamBamUI.MainUI()
        Dim tv As CBFileTreeView = ui.CADFileTree
        Dim cp As CAMPart 


        for each cp in tv.SelectedParts

            app.log(cp.Name)

        next cp

end sub

_________________
Traduction Française de CamBam et de sa documentation.
dh42
dh42
Admin
Admin

Messages : 25132
Points : 37848
Date d'inscription : 21/06/2009
Age : 60
Localisation : Près de St Etienne (42)

http://dh42.free.fr/

Revenir en haut Aller en bas

Cambam : VB Script : Groups d'usinage Empty Re: Cambam : VB Script : Groups d'usinage

Message  dh42 Dim 8 Oct 2017 - 22:54

Pour ajouter un groupe

Code:
sub main

    Dim mypart As New CAMPart

    mypart = CamBamUI.MainUI.ActiveView.CADFile.CreatePart("mypart")

end sub


_________________
Traduction Française de CamBam et de sa documentation.
dh42
dh42
Admin
Admin

Messages : 25132
Points : 37848
Date d'inscription : 21/06/2009
Age : 60
Localisation : Près de St Etienne (42)

http://dh42.free.fr/

Revenir en haut Aller en bas

Cambam : VB Script : Groups d'usinage Empty Re: Cambam : VB Script : Groups d'usinage

Message  Strofe Dim 8 Oct 2017 - 23:00

Bonsoir

Excellent. merci

C'est comment rapide cheers cheers

Je continue mon développement. Je reviens si j'ai d'autres questions.

A+
Strofe
Strofe
je prends du galon
je prends du galon

Messages : 89
Points : 129
Date d'inscription : 07/04/2012
Age : 55
Localisation : BEAUVAIS (OISE)

http://strofe.sonneck.fr/

Revenir en haut Aller en bas

Cambam : VB Script : Groups d'usinage Empty Re: Cambam : VB Script : Groups d'usinage

Message  dh42 Dim 8 Oct 2017 - 23:00

créer le nom de fichier GCode ?

propriété "OutFile"

Code:
<Serializable, HasAdvancedProperties> _
Public Class CAMPart
    Implements Fb9F9e2MWnjj36wvXQ
    ' Methods
    <MethodImpl(MethodImplOptions.NoInlining)> _
    Public Sub New()
    <MethodImpl(MethodImplOptions.NoInlining)> _
    Public Sub New(ByVal src As CAMPart)
    <MethodImpl(MethodImplOptions.NoInlining)> _
    Public Sub New(ByVal name As String)
    <MethodImpl(MethodImplOptions.NoInlining)> _
    Public Function Clone() As CAMPart
    <MethodImpl(MethodImplOptions.NoInlining)> _
    Public Function GetMaterial() As String
    <MethodImpl(MethodImplOptions.NoInlining)> _
    Public Function GetStyleLibrary() As String
    <MethodImpl(MethodImplOptions.NoInlining)> _
    Public Function GetToolLibrary() As String
    <MethodImpl(MethodImplOptions.NoInlining)> _
    Public Sub PropertyChanged(ByVal propertyname As String, ByVal newvalue As Object)
    <MethodImpl(MethodImplOptions.NoInlining)> _
    Public Sub PropertyChanging(ByVal propertyname As String, ByVal newvalue As Object)
    <MethodImpl(MethodImplOptions.NoInlining)> _
    Public Function ShouldSerializeMachiningOrigin() As Boolean
    <MethodImpl(MethodImplOptions.NoInlining)> _
    Public Function ShouldSerializeNestingItems() As Boolean

    ' Properties
    <Browsable(False), XmlIgnore> _
    Public Property CADFile As CADFile
    <Description("If Enabled is True, then display the toolpaths associated with this part and include them in g-code output."), Category("(General)"), DefaultValue(True), XmlAttribute("Enabled")> _
    Public Property Enabled As Boolean
    <DisplayName("Machining Origin"), Description("A drawing point to be used as the machining origin (X=0,Y=0) when gcode is created."), DefaultValue(GetType(Point2F), ""), CBKeyValue, Editor(GetType(PointSelectPropertyEditor), GetType(UITypeEditor)), Category("G-Code Options")> _
    Public Property MachiningOrigin As Point2F
    <Category("(General)"), Description("Descriptive name of this part"), XmlAttribute("Name"), CBKeyValue> _
    Public Property Name As String
    <Description("Nests can be used to create arrays of copies of parts."), Category("Nest"), DefaultValue(GetType(NestingInfo), "None")> _
    Public Property Nesting As NestingInfo
    <XmlArray("NestingItem"), DisplayName("Nesting Items"), DefaultValue(CStr(Nothing)), CBAdvancedValue, Category("Nest")> _
    Public Property NestingItems As NestingItems
    <Description("Filename of the gcode file to create"), Category("Destination"), DisplayName("Out File"), Editor(GetType(CADFileNameEditor), GetType(UITypeEditor)), CBKeyValue> _
    Public Property OutFile As String
    <CBKeyValue, Description("Defines the stock dimensions and location." & ChrW(13) & ChrW(10) & "May be used to determine some values such as stock surface and target depth."), Category("(General)"), DefaultValue(GetType(StockDef), "Undefined")> _
    Public Property Stock As StockDef
    <DefaultValue(CStr(Nothing)), CBKeyValue, Description("All machining operations in the part will use this style unless set otherwise in the machining operation's Style property."), Editor(GetType(CAMStylePropertyEditor), GetType(UITypeEditor)), Category("(General)")> _
    Public Property Style As String
    <DefaultValue(CStr(Nothing)), Description("Used to locate the styles referred to in the Part or machining operations."), DisplayName("Style Library"), Editor(GetType(CAMStyleLibraryPropertyEditor), GetType(UITypeEditor)), Category("(General)")> _
    Public Property StyleLibrary As String
    <CBKeyValue, Editor(GetType(TextPropertyEditor), GetType(UITypeEditor)), Description("A general purpose, multi-line text property to store notes or machining parameters."), DefaultValue(CStr(Nothing)), Category("(General)")> _
    Public Property Tag As String
    <CBKeyValue, DisplayName("Tool Diameter"), Description("Diameter of the current tool in drawing units." & ChrW(13) & ChrW(10) & "If the tool diameter is 0, the diameter from the tool library for the given tool number will be used."), DefaultValue(CDbl(0)), Category("Tool")> _
    Public Property ToolDiameter As Double
    <DefaultValue(CStr(Nothing)), Description("If left blank, the default tool library will be used (Default-{$Units}), otherwise the specified library will be used when looking up tool numbers."), Category("Tool"), Editor(GetType(ToolLibraryPropertyEditor), GetType(UITypeEditor)), DisplayName("Tool Library")> _
    Public Property ToolLibrary As String
    <CBKeyValue, DisplayName("Tool Number"), Description("The ToolNumber is used to identify the current tool, control tool changes and lookup properties from the tool library."), Category("Tool"), DefaultValue(0), Editor(GetType(ToolIndexPropertyEditor), GetType(UITypeEditor))> _
    Public Property ToolNumber As Integer
    <Category("Tool"), DefaultValue(GetType(ToolProfiles), "EndMill"), Description("The shape of the cutter." & ChrW(13) & ChrW(10) & "Use Unspecified to lookup the profile from the tool library."), DisplayName("Tool Profile"), CBKeyValue> _
    Public Property ToolProfile As ToolProfiles

    ' Fields
    <NonSerialized, Browsable(False)> _
    Protected _CADFile As CADFile
    Protected _MachiningOrigin As Point2F
    Protected _Tag As String
    <XmlElement("machineops")> _
    Public MachineOps As MachineOps
    <XmlIgnore, Browsable(False)> _
    Public NestBuilt As Boolean
End Class


_________________
Traduction Française de CamBam et de sa documentation.
dh42
dh42
Admin
Admin

Messages : 25132
Points : 37848
Date d'inscription : 21/06/2009
Age : 60
Localisation : Près de St Etienne (42)

http://dh42.free.fr/

Revenir en haut Aller en bas

Cambam : VB Script : Groups d'usinage Empty Re: Cambam : VB Script : Groups d'usinage

Message  dh42 Dim 8 Oct 2017 - 23:07

Si tu ne l'a pas déjà, je te conseille vivement d'installer ILSpy pour explorer les DLL de CamBam

http://ilspy.net/

J'utilise aussi une V gratuite de NET reflector 6.0 qui donne un affichage plus clair des classes & fonctions qui se trouvent dans les DLL ... mais qui ne permet pas de désassembler les routines internes de Cambam comme ILspy.

pour le développement, même de scripts, j'utilise visual studio 2010 (visual basic) ce qui permet d'avoir la liste des fonctions/paramètres utilisables en direct dans l'éditeur, et ensuite je copie/colle dans l'éditeur de script de CB pour tester.

Cambam : VB Script : Groups d'usinage Sans_t15

++
David

_________________
Traduction Française de CamBam et de sa documentation.
dh42
dh42
Admin
Admin

Messages : 25132
Points : 37848
Date d'inscription : 21/06/2009
Age : 60
Localisation : Près de St Etienne (42)

http://dh42.free.fr/

Revenir en haut Aller en bas

Cambam : VB Script : Groups d'usinage Empty Re: Cambam : VB Script : Groups d'usinage

Message  Strofe Dim 8 Oct 2017 - 23:24

Bonsoir

Merci, c'est excellent comme partage, tu m'apprends à pêcher à la place de me nourrir.

vive le faux rhum

Je vais pouvoir bosser sur mon idée.

A+
Strofe
Strofe
je prends du galon
je prends du galon

Messages : 89
Points : 129
Date d'inscription : 07/04/2012
Age : 55
Localisation : BEAUVAIS (OISE)

http://strofe.sonneck.fr/

Revenir en haut Aller en bas

Cambam : VB Script : Groups d'usinage Empty Re: Cambam : VB Script : Groups d'usinage

Message  dh42 Dim 8 Oct 2017 - 23:27

Merci, c'est excellent comme partage, tu m'apprends à pêcher à la place de me nourrir.

Et les DLL cambam, c'est un peu comme l'océan ... c'est vaste !!



des bouts de code

http://www.cambam.co.uk/forum/index.php?topic=3878.0

_________________
Traduction Française de CamBam et de sa documentation.
dh42
dh42
Admin
Admin

Messages : 25132
Points : 37848
Date d'inscription : 21/06/2009
Age : 60
Localisation : Près de St Etienne (42)

http://dh42.free.fr/

Revenir en haut Aller en bas

Cambam : VB Script : Groups d'usinage Empty Re: Cambam : VB Script : Groups d'usinage

Message  Strofe Mar 10 Oct 2017 - 18:24

Bonjour

Je travaille avec Visual Studio 2015.

ça fonctionne très bien. cheers cheers cheers
J'ai trouvé pour affecter une opération à un groupe.

Code:
mypart.MachineOps.Add()

Encore Merci David. merci merci merci

Je continue mon projet.

A+
Strofe
Strofe
je prends du galon
je prends du galon

Messages : 89
Points : 129
Date d'inscription : 07/04/2012
Age : 55
Localisation : BEAUVAIS (OISE)

http://strofe.sonneck.fr/

Revenir en haut Aller en bas

Cambam : VB Script : Groups d'usinage Empty Re: Cambam : VB Script : Groups d'usinage

Message  Contenu sponsorisé


Contenu sponsorisé


Revenir en haut Aller en bas

Revenir en haut

- Sujets similaires

 
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum