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!

How to make datum and No keep

Status
Not open for further replies.

appvid

Automotive
Nov 9, 2012
81
Hello

I wrote this script that mirros all features in all geometric sets. Now I want to add Make datum, No keep mode to this.

Code:
Sub CATMain()

Dim partDocument1 As PartDocument
Set partDocument1 = CATIA.ActiveDocument

Dim part1 As Part
Set part1 = partDocument1.Part

Dim hybridBodies1 As HybridBodies
Set hybridBodies1 = part1.HybridBodies

Dim hybridShapeFactory1 As HybridShapeFactory
Set hybridShapeFactory1 = part1.HybridShapeFactory

Dim hybridBody1 As HybridBody

Dim originElements1 As OriginElements
Set originElements1 = part1.OriginElements

Dim hybridShapePlaneExplicit1 As HybridShapePlaneExplicit
Set hybridShapePlaneExplicit1 = originElements1.PlaneZX

Dim referenceplane As Reference
Set referenceplane = part1.CreateReferenceFromObject(hybridShapePlaneExplicit1)


Dim i, j As Integer '========================================================================
For i = 1 To hybridBodies1.Count

Set hybridBody1 = hybridBodies1.Item(i)

Dim HybridShapes1 As HybridShapes
Dim HybridShape1 As HybridShape

For j = 1 To hybridBody1.HybridShapes.Count

Set HybridShapes1 = hybridBody1.HybridShapes

Set HybridShape1 = HybridShapes1.Item(j)

MsgBox HybridShape1.Name

Dim reference1 As Reference
Set reference1 = part1.CreateReferenceFromObject(HybridShape1)

Dim hybridShapeSymmetry1 As HybridShapeSymmetry
Set hybridShapeSymmetry1 = hybridShapeFactory1.AddNewSymmetry(reference1, referenceplane)

hybridBody1.AppendHybridShape hybridShapeSymmetry1
 " [COLOR=#CC0000][b]here I WANT TO ADD CODE THAT MAKES DATUM AND NO KEEP MODE" --- Are there any techniques[/b][/color]

Next

Next

part1.UpdateObject hybridBody1

thank you...

regards-appvid
 
Replies continue below

Recommended for you


Hello I'm trying to use this to make isolte and delete parent (keep no mode)

Code:
Dim geotype As Integer
geotype = hybridShapeFactory1.GetGeometricalFeatureType(reference2)

If geotype = 1 Then
Dim hybridShapePointExplicit2 As HybridShapePointExplicit
Set hybridShapePointExplicit2 = hybridShapeFactory1.AddNewPointDatum(reference3)

hybridBody1.AppendHybridShape hybridShapePointExplicit2

part1.InWorkObject = hybridShapePointExplicit2
hybridShapeFactory1.DeleteObjectForDatum reference3


but whats wrong with Set hybridShapePointExplicit2 = hybridShapeFactory1.AddNewPointDatum(reference3)

thanks
appvid

 
Hi,

I saw the post on the German forum and I would say that still the best approach is to follow what I've wrote here

In other words, I wouldn't create everything in the same original part, then isolate and delete original features and save as another part number.

Unfortunately, this week I have a lot of things to finish before going in vacation, so I don't have time to take a closer look on the code and modify it, maybe you will get some help from someone else.


Regards
Fernando

 
Hello Fernando,

Yes I posted my full script in the German forum. I will go through your chm file again to find what I need.

When I copy from my master file to LH side file and mirror then the line,curve,surface graphical properties will be lost. Iam looking to keep same proparties/colors even after mirror action.

I may have to see some options with visproparties.

regards
appvid(var)



 
Code:
Dim geotype As Integer
geotype = hybridShapeFactory1.GetGeometricalFeatureType(reference2)

If geotype = 1 Then
Dim hybridShapePointExplicit2 As HybridShapePointExplicit
Set hybridShapePointExplicit2 = hybridShapeFactory1.AddNewPointDatum(reference3)

hybridBody1.AppendHybridShape hybridShapePointExplicit2

part1.InWorkObject = hybridShapePointExplicit2
hybridShapeFactory1.DeleteObjectForDatum reference3

why cheking ref2 (line 2) if you use ref3 (line 6 & 11 ) after?



Eric N.
indocti discant et ament meminisse periti
 
Hello , Here I am checking type of parent geometry (curve, line, circle).

if geotype was a point my above script suppose to work
or
Based on geotype return value, it would be hybridShapePointExplicit2, or hybridShapecurveExplicit2, or hybridShapelinetExplicit2 etc

I shall post my entire script so that you will understand better

thnaks

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor