×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

hello Ferdo, could you please see t

hello Ferdo, could you please see t

hello Ferdo, could you please see t

(OP)
hello Ferdo, could you please see this and let me know why this code does not work on R18. works great on R20..
highlighted in red is what failing when debugging--thank you


CODE --> CODE

Sub xpart()
'----------------------
'Dim documents1 As Documents
'Set documents1 = CATIA.Documents
Dim partDocument2 As PartDocument
Dim PartDoc1 As Part
Dim selWork    As INFITF.Selection
Dim objBlubb    As Object
On Error Resume Next
Set PartDoc1 = CATIA.ActiveDocument.Part
If Err.Number <> 0 Then
MsgBox ("Open Catia file to generate X FILE")
Exit Sub
End If

Set selWork = CATIA.ActiveDocument.Selection
Set objBlubb = selWork
Call objBlubb.SelectElement3(Array("HybridBody", "Body"), "SELECT BODIES & GEO SETS TO PASTE IN NEW FILE", False, CATMultiSelTriggWhenUserValidatesSelection, True)
selWork.Copy
Dim documents2 As Documents
Set documents2 = CATIA.Documents
Set partDocument2 = CATIA.Documents.add("Part")
Dim part2 As Part
Set part2 = partDocument2.Part
Set selWork = partDocument2.Selection
selWork.add part2
Call selWork.PasteSpecial("CATPrtResultWithOutLink")
selWork.Clear
End Sub 

RE: hello Ferdo, could you please see t

Hi,

Did you checked in Tools-References in VBA editor what you have in one CATIA version and not in other one ?

This could be one of the reasons why is not working....and by the way, which is the error message ?

Regards
Fernando

https://picasaweb.google.com/102257836106335725208

RE: hello Ferdo, could you please see t

(OP)
Hello Fernando sorry for late reply..

there were 2 of them unchecked in v18 comparing to R20.. I did checked them. Please attached image...

and below code suppose to ask user to select bodies. This does not do anything in R18 for some reason..

CODE --> code

Call objBlubb.SelectElement3(Array("HybridBody", "Body"), "SELECT BODIES & GEO SETS TO PASTE IN NEW FILE", False, CATMultiSelTriggWhenUserValidatesSelection, True) 



thanks
appvid

RE: hello Ferdo, could you please see t

Hi,

In the error message is saying that a library is missing.

Please scroll up/down in Tools-References and look at all libraries and uncheck where you will see Missing....

Regards
Fernando

https://picasaweb.google.com/102257836106335725208

RE: hello Ferdo, could you please see t

(OP)
hello, i had to change my workstation.. Could not make it work..

Now the problem is with this code

says can not load dll file.

CODE --> code

Call objBlubb.SelectElement3(Array("HybridBody", "Body"), "SELECT BODIES & GEO SETS TO PASTE IN NEW FILE", False, CATMultiSelTriggWhenUserValidatesSelection, True) 

why so...

regards

RE: hello Ferdo, could you please see t

(OP)
Hello Fernando... good news

this code works

CODE --> code

const CATMultiSelTriggWhenUserValidatesSelection=2

oSel = objBlubb.SelectElement3(Array("HybridBody", "Body"), "SELECT BODIES & GEO SETS TO PASTE IN NEW FILE", False, 2, True) 

I know the problem now. I need to declare every object

example (Dim objSel as Objec, Dim Filename as Integer)

and

I'm using Mid, Replace in my code to change file name. How do I declare them?? Any Idea


thanks
Appvid

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources