Forum Replies Created

Viewing 15 posts - 16 through 30 (of 45 total)
  • Author
    Posts
  • in reply to: SetAbsoluteAxisData method #1702

    Matt
    Participant

    Option Explicit forces you to declare (Dim) every variable. You would need to Dim sketch1 in order to avoid the failure with Option Explicit on.

    in reply to: Reuse Pattern Deletion #1701

    Matt
    Participant

    I don’t see it either, maybe try making a small code to see if there is a typename of the reuse pattern. if it has a type name, search for it in the help document.

    Sub CATMain()
    ‘Select the reuse pattern then tun this macro to see the typename
    ‘of the pattern in your VBA immediate window
    Debug.Print TypeName(CATIA.ActiveDocument.Selection.Item(1).Value)
    End Sub

    in reply to: Convert Files from folder except… #1700

    Matt
    Participant

    Sub ReadFolderExcept()

    ‘Sets user name to the user logged in to the network on this computer
    Dim oNetwork
    Dim sUser As String
    Set oNetwork = CreateObject(“WScript.Network”)
    sUser = oNetwork.UserName

    Dim oFSO ‘As FileSystemObject ‘File System Object grants access to computer files and folders
    Dim oSourceFolder
    Dim oSubFolder
    Dim sSourceFolder As String

    Set oFSO = CreateObject(“Scripting.FileSystemObject”) ‘File System Object grants access to computer files and folders

    sSourceFolder = “C:\Users\” & sUser & “\Desktop\MainFolder” ‘Set the source folder where usage files were stored
    Set oSourceFolder = oFSO.GetFolder(sSourceFolder) ‘Tell File System Object to get a hold of oSourceFolder so you can look into it

    ‘Loop through folders unless they have a specific name
    For Each oSubFolder In oSourceFolder.SubFolders
    If oSubFolder.Name = “BUY-PARTS” Or oSubFolder.Name = “CUSTOMER-PARTS” Then
    ‘do nothing
    Else
    ‘add code to do what you want
    Debug.Print oSubFolder.Name
    End If
    Next

    End Sub

    in reply to: Intersection and add(boolean) #1446

    Matt
    Participant

    It will be easier to measure because you will not need to paste the bolts into the part to create the intersect. Use the SPA workbench to make measurements.

    in reply to: Intersection and add(boolean) #1437

    Matt
    Participant

    So you are intersecting a part with a bolt…the part does not have a hole for the bolt to pass through?

    You cannot create geometry outside of a part. So if you want to make an intersect between the bolt and the part, both of the features (the bolt and the part) need to exist in the same part and an intersect needs to be created.

    If there is no hole where the bolt will pass through, take a measurement between the bolt and the part. If the distance = 0, you know they intersect.


    Matt
    Participant

    Unfortunately, send keys is the only way to do this in VB and it does not work very well…if it works at all.

    in reply to: Intersection and add(boolean) #1431

    Matt
    Participant

    I’m sorry, I’m a little confused. Are you intersecting the bolt to the part? Could you do something that does not require the creation of geometry…like measure from the bolt centerline to the center point of the attachment hole?

    If the distance is 0mm you would need to copy the body for that bolt and paste it into the part.

    in reply to: to change parameter in CATProduct #1420

    Matt
    Participant

    There are a few ways to do it. Would you be able to post your code so we can see what you tried?

    Below loops through the Product’s parameters until it finds the one you want, then changes the value.

    Dim oRootProduct as Product
    Dim oParameters as Parameters
    Dim oParameter as Parameter

    Set oRootProduct=catia.activedocument.product
    Set oParameters=oRootProduct.Parameters

    For I = 1 to oParameters.Count
    If instr(ucase(oParameters.item(i).Name), “NAZEV”) <> 0 then
    Set oParameter = oParameters.Item(I)
    oParameter.Value = “YourValue”
    End if
    Next

    You can also find the parameter by name instead of looping. I think the name of the parameter is actually the path.

    On Error Resume Next
    Err.clear
    oParameter = oParameters.Item(oRootProduct.Name & “\” & “Nazev”)
    If err.number <> 0 then
    Msgbox “Parameter does not exist”
    Else
    oParameter.Value = “YourValue”
    End if
    On error GoTo 0

    in reply to: to change parameter in CATProduct #1417

    Matt
    Participant

    Are you writing a macro to change the value of the parameter in the assembly?

    in reply to: CATScript against MS VBA #1394

    Matt
    Participant

    What did the error say? CATScript is similar to VBA but it doesn’t have all the functionality of VBA.

    This is VBScript versus VBA http://msdn.microsoft.com/en-us/library/ms970436.aspx

    • This reply was modified 2 years, 12 months ago by  Matt.
    • This reply was modified 2 years, 12 months ago by  Matt.

    Matt
    Participant

    Are you saying you will launch catia multiple times and load assemblies in to each session of CATIA?
    or
    catia will be launched once and several assemblies will be loaded into ONE session of CATIA?

    If you are launching multiple catia sessions (not sure why you would want to occupy multiple licenses), I don’t know how to help you.


    Matt
    Participant

    So you launch multiple CATIA sessions on one computer?

    in reply to: rename part in product #1367

    Matt
    Participant

    What do you mean by “the selection of the line to start renaming your part”?

    in reply to: Activate solid in a part #1366

    Matt
    Participant

    I see. The easiest way may be to have a vbOkCancel message box that tells the user that the top assembly has to be in edit mode. Then they have the option to cancel out. You could also count the number of windows before the macro, if the number of windows gets larger, exit the macro.

    in reply to: rename part in product #1329

    Matt
    Participant

    So you press alt+F11 to write your macros?

Viewing 15 posts - 16 through 30 (of 45 total)