×
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

Create View (vb.net) using example from doc

Create View (vb.net) using example from doc

Create View (vb.net) using example from doc

(OP)

I tried and failed to create a view using the example from documentation.
If I used it in CATScript it is working, but if I move it in vb.net it fails at below line with error "Member not found":

CODE --> vb.net

oFrontViewGB.Document = oPartToDraw 

What am I missing?
Help is highly appreciate :)

CODE --> vb.net

' ----------------------------------------------------------- 
	    ' Optional: allows to find the sample wherever it's installed
	    dim sDocPath As String 
	    'sDocPath = CATIA.SystemService.Environ("CATDocView")
	    sDocPath = "\\..........\documentation\CATIAV5\v5r21\English"
	    If (Not CATIA.FileSystem.FolderExists(sDocPath)) Then
	    	Debug.Print("No Doc Path Defined")
	    	Exit Sub
	    End If
	    ' ----------------------------------------------------------- 
	    ' Open the Part document 
	    Dim oPartToDraw As Object 'PartDocument
	    oPartToDraw = CATIA.Documents.Open(sDocPath & "\online\CAAScdDriUseCases\samples\Cube.CATPart")     
	    ' Create a drawing document: it becomes the active document.
	    Dim oDrawing As Object 'DrawingDocument
	    oDrawing = CATIA.Documents.Add("Drawing")
	    ' Retrieve the active sheet
	    Dim oSheet As Object 'DrawingSheet
	    oSheet = oDrawing.Sheets.ActiveSheet
	    ' Create a view called "Front View" in this sheet
	    Dim oFrontView As Object 'DrawingView
	    oFrontView = oSheet.Views.Add("Front View")
	    ' Retrieve it generative behavior
	    Dim oFrontViewGB As  Object 'DrawingViewGenerativeBehavior
	    oFrontViewGB = oFrontView.GenerativeBehavior	    
'	    Debug.Print(TypeName(oPartToDraw))
'	    Debug.Print(oPartToDraw.Name)
	    ' Declare the part to draw in this front view
	    oFrontViewGB.Document = oPartToDraw
	    ' Define this view as a front view, with the XY plane (in oPartToDraw) as projection plane 
	    oFrontViewGB.DefineFrontView (1, 0, 0, 0, 1, 0)
	    ' Position the View in the Sheet
	    oFrontView.x = 300
	    oFrontView.y = 150
	    ' Update the view
	    oFrontViewGB.Update 

RE: Create View (vb.net) using example from doc

did you reference the (usual suspects) CATIA libraries in your VB project references?






I suggest you check in CATIA VBA wwhich libraries your need...

Eric N.
indocti discant et ament meminisse periti

RE: Create View (vb.net) using example from doc

(OP)
Actually I'm not sure :) I usually use same solution and I don't remember if I done this a really long time ago, or if I didn't do it at all.
I will check this and provide feedback.
I suppose I should add and use always all necessary references but I got used without them :(
Thank you for the answer.


RE: Create View (vb.net) using example from doc

(OP)
Nope, I don't think the references are the issues.

I have added below references, but still does not work:
CV5 ApplicationFrame Obj Lib
CV5 Interfaces Obj Lib
CV5 MecModInterfaces Obj Lib
CV5 Product structureInterfaces Obj Lib
CV5 DraftingInterfaces Obj Lib.

I am starting to think that it is not possible to create a view in vb.net :(
Any ideas?

RE: Create View (vb.net) using example from doc

(OP)
In the end I have added the necessary references, I had imported them and I have declared everything.
Now it works.

RE: Create View (vb.net) using example from doc

thanks, cool that you get it to work

Eric N.
indocti discant et ament meminisse periti

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