Comments (11)
Just cloned the repo and run the tests. That test does not fail here.
from pycatia.
You mean the last method in your test file?
Thank you!
from pycatia.
I think you're talking about this
pycatia/tests/test_measurable.py
Line 216 in 1cb3dde
This isn't the last test and while I commented in the code that it failed all the tests do pass (this test is commented out). I wrote these tests sometime ago so I'd forgotten about it and your posts confused me.
I'll have a look at this and see if i can solve it.
from pycatia.
I'm really talking about this. I set part_body as reference but couldn't get the center.
I don't know whether it's my own problem or any other problem or not. After seeing the post, I found that you also encountered this problem, so I came to ask you.
Thanks again!
from pycatia.
This works for me.
from pycatia import CATIADocHandler
from pycatia import CATIAMeasurable
from pycatia import create_measurable
from pycatia import create_spa_workbench
measurable_part = 'tests\\CF_catia_measurable_part.CATPart'
with CATIADocHandler(measurable_part) as handler:
catia = handler.catia
document = handler.document
center = (-47.039, 83.488, 0.0)
spa_workbench = create_spa_workbench(document.document)
part = document.part()
body = part.get_body_by_name('PartBody')
body_reference = part.create_reference(body)
body_measurable = create_measurable(spa_workbench, body_reference)
catia_measurable_body = CATIAMeasurable(body_measurable)
catia_center = catia_measurable_body.get_cog(catia)
print(catia_center)
from pycatia.
Does this method not apply in the products documentation?
For example, I want to get the center of gravity coordinates of a part in products.
from pycatia.
I want to get the center of gravity coordinates of each part in an assembly, and judge the relationship between each part through some algorithms. And I'm sorry that I didn't tell you that I used Visual Basic 6.0 to do CATIA development. Thank you for your reply. You don't need to help me. Let me find a way for myself. If I solve it, I'll let you know at the first time.
from pycatia.
I've just pushed some updates to the Master branch that'll help you do what I think you want.
Take a look at example_10.py.
from pycatia.
I think I still need your help. This is my code written in VB:
Dim part1
Set part1 = selection1.Item(1).Value
Dim ref1 As Reference
Set ref1 = part1.CreateReferenceFromObject(part1.MainBody)
Dim TheSPAWorkbench As Workbench
Set TheSPAWorkbench = CATIA.ActiveDocument.GetWorkbench("SPAWorkbench")
Dim TheMeasurable As Object
Set TheMeasurable = TheSPAWorkbench.GetMeasurable(ref1)
Dim VOL
VOL = TheMeasurable.Volume 'Return the volume of part1
Dim coords(2)
TheMeasurable.GetCOG (coords)
Dim x1, y1, z1
x1 = coords(0)
y1 = coords(1)
z1 = coords(2)
Part1 is a part body, I can get the volume of part1 in this way. But I use GetCOG to get the center of gravity coordinates and return null values. I don't know where the problem is.
from pycatia.
Where is your python code? VB code is no help to me.
from pycatia.
I'm closing this as it doesn't seem to be related to pycatia.
from pycatia.
Related Issues (20)
- [FEATURE REQUEST] Using pycatia to automate operations in machining modules like Prismatic Machining HOT 2
- [FEATURE REQUEST] : Add CATAnalysis type in allowed_document_types HOT 3
- [BUG] [add_new_extrapol_length] TypeError on setting support HOT 1
- Shaft HOT 3
- [QUESTION] Active Document HOT 11
- Save Management in Pycatia HOT 3
- [QUESTION] REMOVE THE PARAMETERSET ??? HOT 6
- [BUG] CATPart, CATProduct documents.read issue HOT 6
- [QUESTION] SELECTION HOT 7
- [QUESTION] select_element3 HOT 3
- [QUESTION] RELATIONS HOT 26
- [SUPPORT REQUEST] HybridShapeFactory.add_new_revol() how does it work? HOT 13
- auto set "DisplayFileAlerts=False" when use "export_data (... overwrite=True)" HOT 2
- [QUESTION] run a macro HOT 10
- Clarifications on how to explore the pycatia API HOT 1
- Bug in Pycatia 0.7.2 HOT 1
- [BUG] can't open files HOT 2
- [QUESTION] Is it possible to find MML links beetween two CATDrawing file? HOT 14
- Access ParameterSets inside an HybridBody HOT 1
- [BUG] Drawing Dimensions.Add Error HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pycatia.