×
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 the (Product+3DShape) couple Catia V6

Create the (Product+3DShape) couple Catia V6

Create the (Product+3DShape) couple Catia V6

(OP)
Hello everyone,
I've been spending days trying to figure out how to create a Product then place in a 3DShape inside this product created, I tried this code below:

CODE --> VBA

Sub CATMain ()
'-----create a product 

dim oNewService As PLMNewService2
set oNewService = CATIA.GetSessionService("PLMNewService2")
Dim oEditor As Editor 
oNewService.PLMCreate "VPMReference",oEditor

'------for the next line i want to add a 3DShape to this product I've created 

oNewService.PLMCreate "3DShape",oEditor  'the 3dshape is created alone in a new window  
End Sub 

as you can see in the code above, I have problem adding a 3DShape to the product ,

for more details , in V5 I can do that using the code below

CODE --> VBA

Sub CATMain ()
dim documents1 As Documents 
set documents1=CATIA.Documents
dim productdocument1 As ProductDocument
set productdocument1=documents1.Add("Product")
dim products1 As Products
set products1=productdocument1.Products
dim product2 as product
set product2=products1.AddNewComponent("Part","")
End Sub 

Any hint is really appreciated!

Regards

RE: Create the (Product+3DShape) couple Catia V6

(OP)
Can someone please help me out? bowleft

RE: Create the (Product+3DShape) couple Catia V6

(OP)
LWolf
thank you, I really appreciate your feedback , I've already checked this topic, its not what I'm looking for,

ferdo
thank you for reply , could you please copy the thread presented in your COE Link, cuz I'm trying to access to the link but the login page keeps me of the thread, I registered but still not receiving the mail containing my password,



Thanks for your attention. I’m looking forward to your reply.

________
regards

RE: Create the (Product+3DShape) couple Catia V6

@KABEL, please send email to coe@coe.org if you have a problem, they should be able to fix it.

Eric N.
indocti discant et ament meminisse periti

RE: Create the (Product+3DShape) couple Catia V6

(OP)
ferdo
Many thanks, you're too kind,I really appreciate your support,
First I'm using catia v6R2013, What I want to achieve is to create PDD (product) then insert (create inside) a 3DD (3DShape);
I found this way :
  • Retrieve the VPMReference object from the PDD after it has been created(root object of the editor : MyEditor3DShape1)
  • Retrieve the 3DShape object after it has been created (root object of the editor : MyEditor3DShape2)
  • Instantiate 3DD behind PDD (VPMRefPDD.Instances.Add 3DShape, VPMNewInst)
  • Close MyEditor3DShape2
here is my code :

CODE --> vba

Sub CATMain()

Dim My3DPartService As PLMNewService2
Set My3DPartService = CATIA.GetSessionService("PLMNewService2")
Dim MyEditor3DShape As Editor

My3DPartService.SetAttributeValue "V_CustoDiscipline", "PDD"
My3DPartService.PLMCreate "VPMReference", MyEditor3DShape               'the product now is created 

'   -   Retrieves the Product Service
    Dim MyProductService As PLMProductService
    Set MyProductService = CATIA.GetSessionService("PLMProductService")

'   -   Retrieves the Root Occurrence
    Dim MyVPMRootOcc As VPMRootOccurrence
    Set MyVPMRootOcc = MyProductService.RootOccurrence

'get vpmreference
Dim oVPMRefOnRoot As VPMReference
Set oVPMRefOnRoot = MyVPMRootOcc.ReferenceRootOccurrenceOf

' Create 3DPart
Dim oEditor3DShape As Editor
My3DPartService.SetAttributeValue "V_CustoDiscipline", "3DD"
My3DPartService.PLMCreate "3DShape", oEditor3DShape                 'the 3DShape is now created in a new window 

' Get Part from Editor
Dim oPart3D As Part
Set oPart3D = oEditor3DShape.ActiveObject

' Get VPMRepReference
Dim oVPMRepRef As VPMRepReference
Set oVPMRepRef = oPart3D.Parent

' Get VPMReference
Dim oVPMRef As VPMReference
Set oVPMRef = oVPMRepRef.Father          '<=== I got an error for this line  " the Father method of the object VPMRepReference failed 

'' Get window of initial 3dShape creation
Dim oMy3DPartWindowToClose As Window
Set oMy3DPartWindowToClose = CATIA.ActiveWindow

' Insert 3DPart Under root product
Dim oVPMInst As VPMInstance
oVPMRefOnRoot.Instances.Add oPart3D, oVPMInst   '<==== also for this line, type mismatch , the oPart3D need to be a VPMReference object , 

' Close 3DPart window
oMy3DPartWindowToClose.Close

End Sub 

please help me out, I'm really stuck
thanks again,
------------------------------------------------------------------------------
itsmyjob
thank you, I really appreciate your feedback, I'll try to get in touch with their support , thank you.
Regards


RE: Create the (Product+3DShape) couple Catia V6

You go up from the VPMRepRef to the VPMRef by passing by the VPMRepInstance

then maybe replace the oPart3D in the final line with the oVPMRef

Eric N.
indocti discant et ament meminisse periti

RE: Create the (Product+3DShape) couple Catia V6

(OP)
itsmyjob
could you please show me (the code) how to do that ?
thanks in advance
regards;

RE: Create the (Product+3DShape) couple Catia V6

@kabel...

Sorry I was wrong:

CODE --> VBA

Dim oVPMRef As VPMReference
Set oVPMRef = oVPMRepRef.Father 


is good, it's just that the 3DShape editor is on a shape with no Part or product above, that's why its failing.

I try

CODE --> VBA

My3DPartService.PLMCreate "3DPart", oEditor3DShape 


but I receive licensing error, I know that with proper license it worked because I use this and just copy/paste the part from the new editor to the product where I wanted the instance...

I guess you should talk to your VAR or DS about this...

Can you make a Product template then use it to create new part/shape in your product so you bypass the lic. limitation?

Eric N.
indocti discant et ament meminisse periti

RE: Create the (Product+3DShape) couple Catia V6

(OP)
itsmyjob
Thank you too much, I understand now,
in my case I don't receive any licencing error, the only thing I can't do is to create a 3DPart, I receive an error on the checking of the discipline client attribute SetAttributeValue "V_CustoDiscipline","PDD", I'm getting in touch with the DS about this issue,
thank you again, I really appreciate your help,
------------
Regards

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

eBook - Efficient and Effective Production Support with 3D Printed Jigs and Fixtures
Jigs and fixtures offer manufacturers a reliable process for delivering accurate, high-quality outcomes, whether for a specific part or feature, or for consistency across multiples of parts. Although the methodologies and materials for producing jigs and fixtures have evolved beyond the conventional metal tooling of years past, their position as a manufacturing staple remains constant due to the benefits they offer. Download Now
Overcoming Cutting Tool Challenges in Aerospace Machining
Aerospace manufacturing has always been on the cutting edge, from materials to production techniques. However, these two aspects of aerospace machining can conflict, as manufacturers strive to maintain machining efficiency with new materials by using new methods and cutting tools. Download Now

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close