CATIA V5 script - creating mulitple holes on complex surface
CATIA V5 script - creating mulitple holes on complex surface
(OP)
thread560-251808: CATIA Portable Script Center
Hi,
I am a beginner with scripts and was wondering.
If I have a complex (non planer) surface with multiple points defined within a geometric set, is there a way to instantiate multiple holes on that complex surface? Similar to user pattern but instead of choosing a sketch as the pattern you would choose the geo set of points.
I've read that this is possible but I have not seen any CATscript file on this.
Thanks for the help!
-Long
Hi,
I am a beginner with scripts and was wondering.
If I have a complex (non planer) surface with multiple points defined within a geometric set, is there a way to instantiate multiple holes on that complex surface? Similar to user pattern but instead of choosing a sketch as the pattern you would choose the geo set of points.
I've read that this is possible but I have not seen any CATscript file on this.
Thanks for the help!
-Long





RE: CATIA V5 script - creating mulitple holes on complex surface
RE: CATIA V5 script - creating mulitple holes on complex surface
RE: CATIA V5 script - creating mulitple holes on complex surface
http://www.coe.org/p/fo/st/thread=26195
Win XP64
R20/21, 3DVIA Composer 2012, ST R20
Dell T7400 16GB Ram
Quadro FX 4800 - 1.5GB
RE: CATIA V5 script - creating mulitple holes on complex surface
I created a User Defined Feature (UDF), a HOLE that was created using 2 inputs, a FLAT surface and a point. Once saved into my catalog, I was able to instantiate more HOLE features using the catalog. However when I tried to instantiate the feature on a complex surfaces (non-planer), I was not able to select the complex surface as an input. In other words, I could only select FLAT surfaces.
I thought maybe it was the way I originally created the UDF so I tried to recreate the UDF using a HOLE feature that was created on a complex surface. However this proved unsuccessful as the UDF would not accept that feature.
I am still many steps away from creating a successful knowledge pattern but it seems as though this path may not work for my application especially since a UDF is required for the knowledge pattern and UDF is not possible in my case.
AM I MISSING SOMETHING? can anyone offer another alternative? possibly a script? thanks!
RE: CATIA V5 script - creating mulitple holes on complex surface
RE: CATIA V5 script - creating mulitple holes on complex surface
I tried constructing the UDF from a HOLE element on a planer and non-planer surface but it does not accept the HOLE element from the non-planer surface. I keep getting the error message "ERROR IN DEFINITION"
RE: CATIA V5 script - creating mulitple holes on complex surface
The first UDF (PlaneTangent) has 2 inputs (Surface, Point). The output is a PLANE tangent to that surface at the point
The second UDF (HoleNormal) has 2 inputs (Plane, Point). The output is a HOLE normal to the plane at the point.
Note, this works for both planer and non-planer surfaces. I also saved my UDF to catalog (ARMCatalog).
How would I write the code for the knowledge pattern to loop these UDF?
RE: CATIA V5 script - creating mulitple holes on complex surface
Here is what I have so far for the (PlaneTangent) UDF which creates a plane tangent to surface at point: (copied and manipulated from a different post from you - Catia V5 - Points to Spheres)
let i(integer)
let PointList(list)
let ListSize(integer)
let PlaneTangent(UserFeature)
PointList='Geometrical Set.1'.Query("Point","")
ListSize=SL->Size()
i=1
For i while i <=ListSize
{
PlaneTangent=CreateOrModifyTemplate("ARMCatalog|PlaneTangent",PlaneSet ,`Relations\KnowledgePattern.3\PlaneList` , i)
PlaneTangent->SetAttributeObject("Point",PlaneList ->GetItem(i))
EndModifyTemplate(PlaneTangent)
i=i+1
}
getting Syntax Error line 4:
Parameter' cannot be used in this context.
Given: I am using the same path/directory. Same catalog "ARMCatalog". My UDF is saved as "PlaneTangent.CATGScript". The Name is PlaneTangent. The Inputs are named "Point" and "Surface". The Type generation was Auto and is (SkinFeature) and the Type1 was titled PlaneTangent.
RE: CATIA V5 script - creating mulitple holes on complex surface
You should be able to create just one udf. A good method creating a udf is to use an empty catpart and just add or create those elements that you want to use as input for the udf. In this case a curved surface and a point on the surface to start with, from that point create a line perpendicular to the surface and then a plane to place the hole/pocket.
I see that you "type" the udf to get the catgscript but have you also set the Knowledge environment in tools/option/parameters? So the KBE folder structure is created on the choosen path and the catgscript is created in the right place (knowldegeTypesCustom folder) and put the catalog and the part with udf in the knowledgeResourcesCatalogs folder. I've heard that this is not needed if the udf is in the same part as the pattern, that you can call on the udf directly, haven't tried it though... good to know maybe.
Regarding your code in the knowledge pattern I see some possible issues, it's little trickier when I don't see the environment and are not sure how you have made some steps.
You have typed the udf so I would try to declare it differently in the code, think that "let PlaneTangent(UserFeature)" can be used if it's not typed.
Try:
Let PTudf(PlaneTangent)
I'm just guessing that you have typed it as PlaneTangent, check the name of the catgscript.
You stated that the udf has two inputs but I only see one used in the code. A benefit with typed udf's are that you can directly call their inputs by their names.
Where is the other udf input? the surface? The variable SL is not declared, I guess it's the list
My version would look like:
let i(integer)
let PList(list)
let ListSize(integer)
let PTudf(PlaneTangent)
PList='Geometrical Set.1'.Query("Point","")
ListSize=PList->Size()
i=1
For i while i <=ListSize
PTudf=CreateOrModifyTemplate("ARMCatalog|PlaneTangent",PlaneSet ,`Relations\KnowledgePattern.3\PlaneList` , i)
PTudf.Point=(PList ->GetItem(i))
PTudf.Surface=??the missing surface???
EndModifyTemplate(PTudf)
i=i+1
}
Another interesting thing with knowledge patterns are that you can use it to create datum elements, with the function CreateOrModifyDatum, so this first udf you have made can be done in the code. Which R level du you have?
RE: CATIA V5 script - creating mulitple holes on complex surface
To clarify why I think 2 UDF's are required; I am given a solid with complex surface and geometric set of points that represent center points for holes on that complex surface. The HOLE command in CATIA only requires 2 inputs to work(a point and surface). 1 UDF would work but for some reason I keep getting an error when trying to create this UDF. See attached 1.JPG for error message.
If the UDF required input was (point and plane) instead of (point and surface)then it works fine. However this means I would have to create an additional geometric set of planes to go with the points. This is why I thought it would be easier to create 2 UDF's. One UDF to create the planes tangent to the surface at the points and the second UDF to create the hole normal to those planes at the points.
That said If I can figure out how to get 1 UDF to work then I think I can eventually figure out how to get 2 to work. I've attached a few screenshots of my spec tree and knowledge pattern. Note this is just for 1 UDF, to create a plane tangent to the surface at the given point.
I don't know how to attach multiple attachments so I will have separate post for the other 3 attachments.
RE: CATIA V5 script - creating mulitple holes on complex surface
RE: CATIA V5 script - creating mulitple holes on complex surface
RE: CATIA V5 script - creating mulitple holes on complex surface
RE: CATIA V5 script - creating mulitple holes on complex surface
Change let PTudf(PlaneTangent)
let PTudf(Plane)
Win XP64
R20/21, 3DVIA Composer 2012, ST R20
Dell T7400 16GB Ram
Quadro FX 4800 - 1.5GB
RE: CATIA V5 script - creating mulitple holes on complex surface
This is open for debate, but selecting a face of a solid can lead to unstable models if you delete parent features. Personal preference for me would be to create a body and use a hole from a plane and point.
Win XP64
R20/21, 3DVIA Composer 2012, ST R20
Dell T7400 16GB Ram
Quadro FX 4800 - 1.5GB
RE: CATIA V5 script - creating mulitple holes on complex surface
I am now getting a Syntax error on line 12. See attached 6.JPG.
RE: CATIA V5 script - creating mulitple holes on complex surface
Win XP64
R20/21, 3DVIA Composer 2012, ST R20
Dell T7400 16GB Ram
Quadro FX 4800 - 1.5GB
RE: CATIA V5 script - creating mulitple holes on complex surface
Win XP64
R20/21, 3DVIA Composer 2012, ST R20
Dell T7400 16GB Ram
Quadro FX 4800 - 1.5GB
RE: CATIA V5 script - creating mulitple holes on complex surface
1) No resource with logical name PlaneTangent has been found in the catalog ARMCatalog (extended search not activated)
2)The string "ARMCatalog|PlaneTangent" given as identifier in the method CreateOrModifyTemplate is not correct:
either the catalog ARMCatalog does not exist or the catalog description PlaneTangent does not exist.
I verified, under tools/options/parameters and measure/knowledge environment, I've set the path for the "Reference Directory For Types" to (c:\...\knowledgeTypesCustom) and the "Architect Resources Creation Path" to (c:\...\knowledgeResourcesCatalogs). I've saved my catalog and UDF in the (c:\...\knowledgeResourcesCatalogs) folder.
RE: CATIA V5 script - creating mulitple holes on complex surface
Name (default naming is ok)
Logical Name (PlaneTangent)
Type (UserFeature)
Usage <unset>
RE: CATIA V5 script - creating mulitple holes on complex surface
RE: CATIA V5 script - creating mulitple holes on complex surface
Can you upload a picture of your UDF's spec tree and also the Userfeature Definition box? I am curious how you constructed the UDF. Was the UDF constructed on a flat surface? Did you generate a TYPE or rename your inputs in the definition box? If so can you show what you used? I am trying to recreated what you've shown to begin with and then make modifications from there.
RE: CATIA V5 script - creating mulitple holes on complex surface
I have post "tool for Catia"
with macro
"prise de pression"
create holes in complexe surfaces
This macro is in french but i try to translate and not sure about the english catia words
Camadian
RE: CATIA V5 script - creating mulitple holes on complex surface
RE: CATIA V5 script - creating mulitple holes on complex surface
RE: CATIA V5 script - creating mulitple holes on complex surface
1) One thing I did not realize when creating the UDF you could have multiple internal components. My original UDF consisted of 1 internal component (Hole) and 2 Inputs of components (Point and Face). This lead to a UDF creation error. To fix this I added the tangent plane of my hole feature to my internal components. This does not change the number of input components.
2) In the Userfeature Definition, under Inputs tab, I intitially changed my inputs from "point.1" to "point" and "...face.1" to "Surface". IN the knowledge pattern, you have to reference these inputs and using the string "point" was causing an error. I tested this by changing the string to a less generic string "POS" and it works. I've since changed all my strings in my UDF, arm, and knowledge pattern to less generic words to avoid this problem.
3) Creating the catalog was also a challenge if you don't know the requirements. I originally created the catalog within the PKT workbench using the tool "Save in Catalog". This saves all the knowledge templates you currently have loaded in that model into a new or existing catalog. The problem with this method is that the new component created in the catalog does not have the 4 required keywords, "name", "logical name", "usage", and "type". In short I found it easier to create the catalog component from scratch then trying to delete and recreated the necessary keywords.
The knowledge pattern code itself is not that tricky. I found towards the end that most of the errors I had when executing the knowledge pattern was not in the code but rather the root cause was in the UDF and catalog. Just make sure you don't have any typos.
Thanks everyone for your help!
RE: CATIA V5 script - creating mulitple holes on complex surface
If you didn't know you can now take the knowledge pattern and make a power copy of it (don't forget to get all the necessary components) and store it in a catalog where you publish it so it can be added as a feature in a toolbar.
RE: CATIA V5 script - creating mulitple holes on complex surface
indocti discant et ament meminisse periti