Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

hello Ferdo, could you please see t

Status
Not open for further replies.

appvid

Automotive
Nov 9, 2012
81
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:
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
[COLOR=#EF2929][b]Call objBlubb.SelectElement3(Array("HybridBody", "Body"), "SELECT BODIES & GEO SETS TO PASTE IN NEW FILE", False, CATMultiSelTriggWhenUserValidatesSelection, True)[/b][/color]
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
 
Replies continue below

Recommended for you

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:
Call objBlubb.SelectElement3(Array("HybridBody", "Body"), "SELECT BODIES & GEO SETS TO PASTE IN NEW FILE", False, CATMultiSelTriggWhenUserValidatesSelection, True)



thanks
appvid
 
 http://files.engineering.com/getfile.aspx?folder=34bcb07e-3951-449f-9ff2-18c849d62ccf&file=Slide1.JPG
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:
Call objBlubb.SelectElement3(Array("HybridBody", "Body"), "SELECT BODIES & GEO SETS TO PASTE IN NEW FILE", False, [b]CATMultiSelTriggWhenUserValidatesSelection[/b], True)

why so...

regards
 
Hello Fernando... good news

this code works
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

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor