I usually try to
read a file into CATIA,
work on the data,
and then dump out the data into the file in one go.
and not go back and forth throughout the script execution...
yupp, so you will need a VB script and a reaction triggering your curve's update -- both are created from within the Knowledge Advisor Workbench.
In the script definition you just specify the argument: "MyOptim" and in the body you state: MyOptim.run(false)
The reaction which you set up to be...
if you have access to PEO workbench (Product Engineering Optimizer), then you can easily set up an optimization;
you need a real parameter that has a formula calculating the curvature,
and a point on curve (ratio). in the optimization.
the optimized parameter would be the Real parameter, and...
documentation of pycatia seems to be a bit incomplete...
this works on my side...
from pycatia import catia
catia_app = catia()
documents=catia_app.documents
print(documents)
part = documents.item(1).part
spa_workbench = documents.item(1).spa_workbench()
hybrid_bodies = part.hybrid_bodies...
yeah, sorry I was a bit sloppy...
x,y,z and t are real.
trig functions need deg or rad as a unit, that is why I explicitly multiply my real parameter t with the unit (*1deg).
Angle.1 parameter is already defined as [deg]
t runs always from 0 to 1 so the below will draw a helix (circle if z=0)...
you create each equation as a fog-law (located behind the design-table icon). a and b are just ordinary real parameters, BUT y and t(heta) are your formal parameters
i.e y=a*exp(b*t)*cos(t*180/PI)
so you end up with three fog laws, which you then use to define your "curve from equations" in GSD
you need to add/create the actual project-feature (inside a geo-set i.e a hybridbody)
yourhybridBody.AppendHybridShape hybridShapeProject1
yourpart.UpdateObject hybridShapeProject1
yourhybridbody and yourpart are defined prior in your code
' Function to construct a BRep name for a given geometric element
Public Function GetBrep(MyBRepName As String) As String
' Remove "Selection_" prefix from the name
MyBRepName = Replace(MyBRepName, "Selection_", "")
' Get the part of the name before the closing parentheses
MyBRepName =...
in Tools-Options, navigate to the correct tab of the Drafting preferences, and dump out values of that particular tab, (it is the second button from left, in lower left corner of the options toolbar)
Here is a snippet with relevant data:
long9 = settingRepository1.GetAttr("DrwProject3DSymbol")...
there is a step inbetween design-mode and cgr-mode:
[code]oRootDoc.Product.ApplyWorkMode DEFAULT_MODE 'Required setting to retrieve Product properties (Definition) in visualization mode [/code ]
regards,
LWolf
all BReps tend to be very long names... so yeah it is possible to infer whether the selection was made on a topology/implicit element (face, edge or vertex) or proper/explicit.
regards,
LWolf
in "User Selection Filter" there is a command that selects whole features, even if you click on a patch:
"Feature Element Filter". You can engage it prior to user-selection:
CATIA.StartCommand "Feature Element Filter"
But this will only be valid whilst nothing is selected prior to running the...
How are your parameters defined, what units/dimensions do you have?
You are creating a string defining the KWA input, as if you were manually using the Formula editor e.g.:
Dim String1 As String
String1 = "ToString(round(" & Part.Parameters.GetNameToUseInRelation(CentralCpt) &...