Tuesday, April 24, 2012

How to Insert Symbols in Excel

I've created a new "How To" video tutorial showing you how to insert symbols, like the degree sign, into a Microsoft Excel spreadsheet, using three different methods including the character map.

Tuesday, April 17, 2012

Make spheres in CATIA with VBA


How to create spheres in CATIA with a VBA macro

One of the most asked questions of me is how do you make a sphere in CATIA V5? There are multiple methods, of course, but today I am going to share with you a method to create spheres with a VB CATScript. This will be a good tutorial for those who want to learn CATIA V5 macros. First, create a geometrical set containing nothing but a point out in space. This macro will make a new sphere at the point at a radius of a size you specify via an input box. Below is the CATScript for CATIA example. I've inserted a few screenshots along the way to help you understand script what does what.
(I use an underscore anytime a line of code gets too long and runs onto a second line but please note these need to be deleted and the code restored to one line in order for the macro to work).

Language="VBSCRIPT"
Sub CATMain() 

Msgbox "Select the geometrical set containing the points to create spheres" 

DimDocument,Part,Selection,HybridShapeFactory,HybridBodies,HybridBody,OriginElements,Plane,PlaneReference,Status
Dim InputObjectType(0),PointIndex,PointReference,HybridShapeSymmetry

Set Document = CATIA.ActiveDocument : Set Part = Document.Part : Set Selection = _Document.Selection

Set HybridShapeFactory = Part.HybridShapeFactory
InputObjectType(0)="HybridBody"
Status=Selection.SelectElement3(InputObjectType,"Select the geometrical set containing points",_
true,CATMultiSelTriggWhenSelPerf,false) 


if (Status = "Cancel") then Exit Sub
set hybridbody1 = Selection.Item(1).Value

Dim Dia As String
Dim DiaInch As Integer
Dia = InputBox("What size radius? - Spheres will have radius in mm") 



DiaMm = Dia
'~ DiaInch = Dia * 25.4
Dim hybridShapes1 As HybridShapes
Set hybridShapes1 = hybridBody1.HybridShapes

For i=1 to hybridShapes1.Count
 Dim hybridShapePointCoord1 As HybridShape
 Set hybridShapePointCoord1 = hybridShapes1.Item(i)
 Dim reference1 As Reference
 Set reference1 = part.CreateReferenceFromObject(hybridShapePointCoord1)
 Dim hybridShapeFactory1 As Factory
 Set hybridShapeFactory1 = part.HybridShapeFactory
 Dim hybridShapeSphere1 As HybridShapeSphere
 Set hybridShapeSphere1 = hybridShapeFactory1.AddNewSphere(reference1, Nothing, DiaMm,_-45.000000, 45.000000, 0.000000, 180.000000) 
 
hybridShapeSphere1.Limitation = 1
hybridBody1.AppendHybridShape hybridShapeSphere1 

part.Update
Next ‘i
End Sub

Notice in the above code where you can change the end angles if you don't want a complete sphere. After running the macro you will have a 3D surface in the shape of a sphere. Next, you can go into the Part Design workbench and do a “close surface” on the sphere geometry to create a solid part body. And now that we have our geometry we can learn how to shell the sphere if needed.

Learn how to write more CATIA catscript macros. 

Tuesday, April 10, 2012

What is CATIA UUID?


One of the biggest CATIA mysteries for new users is what is UUID and what does it stand for? UUID stands for a Universal Unique IDentifier. Every CATPart and CATProduct contains a UUID. Basically, CATIA identifies files based on their file name and their UUID. Where problems occur are when two pieces of data have the same UUID. Compounding the problem, the UUID can’t be viewed or edited with any current CATIA function. There are cases when two files may have different names but share the same UUID.

Actions which will create new UUID include:
·        File + new
·        File + new from
·        File + save As - option save as new document
·        INSERT new Product
·        INSERT new part
·        Document Template Creation

Actions which will keep the same UUID for each include:
·        File + open
·        File + save management
·        File + save
·        File + SaveAs
·        Send to directory
·        File + CLOSE
·        File + save
·        File + save ALL

Tuesday, April 3, 2012

CATIA Error: Generic Naming Graph Treatment


CATIA V5 is full of many wonderful surprises in the form of weird error messages. One of my favorite is "Click OK to terminate: Yes or No" but it doesn't matter which option you choose, CATIA still crashes and closes unexpectedly. I recently had the pleasure of discovering a new problem that I had never encountered or even heard of before. I was in the process of updating a CATPart when an update error popped up displaying: "An error occurred in Generic Naming graph treatment." The update cycle was stopped and would not continue. The issue occurred every time I tried to update the part file. Better yet, I couldn't find any information about this particular error anywhere on the internet. Has anyone else experienced this problem or have any idea what the exact cause could be? I have to admit I'm at a bit of a loss here. Fortunately, I was able to eventually work around the issue but I would still like to know what the error means. 

Join our new CAD Systems Help Facebook page for the latest updates and information
.