All Projects β†’ qd-cae β†’ qd-ansa-extension

qd-cae / qd-ansa-extension

Licence: GPL-3.0 License
awesome python library for ANSA/META - makes scripting comfortable and fast

Programming Languages

python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to qd-ansa-extension

delegated-execution-subscriptions
πŸ•°οΈβš™οΈRecurring delegated execution through an identity proxy with meta transactions
Stars: ✭ 42 (+61.54%)
Mutual labels:  meta
Harbour-MVP
Building a decentralised p2p meta-tx relayer network [MVP] Codename: Harbour ## We solved this problem: https://medium.com/tabookey/1-800-ethereum-gas-stations-network-for-toll-free-transactions-4bbfc03a0a56
Stars: ✭ 31 (+19.23%)
Mutual labels:  meta
ember-meta
Setup meta for your Prember/Ember blog to support opengraph, microdata, Facebook, Twitter, Slack etc.
Stars: ✭ 15 (-42.31%)
Mutual labels:  meta
meta-theme-sky-color
Js snippet that changes the mobile Chrome nav bar color to the color of the sky based on time of day.
Stars: ✭ 19 (-26.92%)
Mutual labels:  meta
BadgeHub
Raspberry Pi, Dymo Turbo Writer 450 badge printing service that logs user information such as name and email and prints a name badge and QR code associated with that information.
Stars: ✭ 25 (-3.85%)
Mutual labels:  meta
H2PC TagExtraction
A application made to extract assets from cache files of H2v using BlamLib by KornnerStudios.
Stars: ✭ 12 (-53.85%)
Mutual labels:  meta
Silverstripe-SEO
A SilverStripe module to optimise the Meta, crawling, indexing, and sharing of your website content
Stars: ✭ 41 (+57.69%)
Mutual labels:  meta
laravel-meta
a package for working with models meta in laravel
Stars: ✭ 78 (+200%)
Mutual labels:  meta
metalang
Meta-language used to generate code stubs in a variety of real-world programming languages.
Stars: ✭ 19 (-26.92%)
Mutual labels:  meta
wp-blog-meta
A global, joinable meta-data table for your WordPress Multisite sites
Stars: ✭ 25 (-3.85%)
Mutual labels:  meta
metameta
Metameta is meta core and meta-class programming framework.
Stars: ✭ 39 (+50%)
Mutual labels:  meta
javascript-can-do-what
Talk: JavaScript can do WHAT?!
Stars: ✭ 16 (-38.46%)
Mutual labels:  meta
documentation
DocPad's Documentation. Cloned into the Bevry and DocPad websites for generation. Replaced by GitBook: https://docpad.bevry.me
Stars: ✭ 19 (-26.92%)
Mutual labels:  meta
audio-tag-analyzer
Extracts metadata music metadata found in audio files
Stars: ✭ 18 (-30.77%)
Mutual labels:  meta
tokensubscription.com
β°πŸ’°πŸ€  Set-it-and-forget-it token subscriptions on the Ethereum mainnet. #Winner #WyoHackathon
Stars: ✭ 81 (+211.54%)
Mutual labels:  meta
laravel-assets
Laravel Assets manager
Stars: ✭ 13 (-50%)
Mutual labels:  meta
QSerializer
This repo for Qt/C++ serialization objects in JSON or XML based on QtCore
Stars: ✭ 33 (+26.92%)
Mutual labels:  meta
awesome
my personal collection of awesome projects, links, books.
Stars: ✭ 16 (-38.46%)
Mutual labels:  meta
-meta
πŸ“— For goals, architecture of the program, and how-tos.
Stars: ✭ 26 (+0%)
Mutual labels:  meta
Toolbelt.Blazor.HeadElement
Head element support (change the document title, "meta" elements such as OGP, and "link" elements) for Blazor apps.
Stars: ✭ 137 (+426.92%)
Mutual labels:  meta

qd-ansa

This library is a python utility library for ANSA and META from Beta CAE Systems SA. The project is not affiliated in any way with the official software.

These enhancements make access much easier, and also debugging! This module was written for the reason, that the common scripting API did not feel pythonic enough to me.

Authors: D. Toewe, C. Diez

Installation

Just copy the fles into your installation folder: /Path/to/BETA_CAE_Systems/shared_v17.0.2/python/win64/Lib/site-packages

META Example

The META API has currently only one function, which exports your current model to an html file. Currently only shell elements are supported.

import webbrowser
from qd.meta.export import export_to_html

export_to_html("Filepath/for/HTML", use_fringe=True, fringe_bounds=[0,0.03] )
webbrowser.open("Filepath/for/HTML")

Download example HTMLs here.

Live Video here.

ANSA Example

The ANSA API was wrapped for usability. I concentrated many (static) functions into the class QDEntity and got rid of annoying additional arguments.

from ansa import base
from qd.ansa import QDEntity

# never forget the help ...
help(QDEntity)
# >>> A lot of text ...

# NOTE:
# Some ANSA Model is already open

ansa_entity_list = base.CollectEntities(base.CurrentDeck(), None, "GRID") # method from ANSA
qd_entity_list = QDEntity.convert(ansa_entity_list) # converts single entities, lists and dicts
qd_entity_list = QDEntity.collect("GRID") # get them directly, more comfortable :)

entity = QDEntity.get("NODE", 1) # get an entity directly

entity.cards()
# >>> ['TYPE', 'NID', 'CP', 'X1', 'X2', 'X3', 'CD', 'PS', 'SEID', 'field 10', 'Name', 'FROZEN_ID', 'FROZEN_DELETE', 'AUXILIARY', 'Comment']

entity["TYPE"] # access like a dict
# >>> "GRID"

entity["X1","X2","X3"] # also lists work
# >>> [0.0, 20.0, 0.0]

entity["X1","X2","X3"] = [1., 19., 1.] # either string or list(str) setter
entity["X1","X2","X3"]
# >>> [1.0, 19.0, 1.0]

# error messages ...
print(entity["UNKNOWN"])
# >>> KeyError: 'Key not found: UNKNOWN' 

# we can iterate over the entity, like a dictionary
for card_name, card_value in entity:
    pass

Classes

QDEntity

Static Functions Short Explanation
QDEntity.create(entity_type, deck=base.CurrentDeck(), **card_properties) Static function for entity creation
QDEntity.convert(arg) Static function for conversion of an entity or containers
QDEntity.collect(search_type, container=None, deck=base.CurrentDeck(), **kwargs) Static function for collecting entities from the database
QDEntity.get(search_type, element_id, deck=base.CurrentDeck(), **kwargs) Static function for getting an element from its type and id

Member Functions Short Explanation
QDEntity(entity, deck=None) Constructor from an ansa.base.Entity
QDEntity.__len__() Overloaded len, returns numbe of cards
QDEntity.__getitem__(key) Overloaded [], access entity cards like a dictionary, also accepts lists
QDEntity.__setitem__(key, value) Overloaded [], change single or multiple card values directly
QDEntity.__iter__() Overloaded iterator for loops, iterate over card names and values in the entity
QDEntity.collect(search_type, deck=self.myDeck, **kwargs) Collect entities, container is the instance itself
QDEntity.cards() Get all of the entities card names as list(str)
QDEntity.keys() Same as QDEntity.cards()
QDEntity.values() Get all of the entities card values as list
QDEntity.set_deck(deck) Set the entity deck manually, use ansa.constants
QDEntity.user_edit() Pops the entity card for the user for editation.

Detailed Description

QDEntity.create(entity_type, deck=base.CurrentDeck(), **card_properties)

This static method creates a QDEntity. It is a wrapper for base.CreateEntity. One has to specify solely the Type. All other optional arguments are passed as a dictionary to the function, so that attribtues may be set directly.

qd_entity = QDEntity.create("GRID") # create a grid
qd_entity = QDEntity.create("GRID", X1=10, X2=20, X3=10) # create a grid with values

QDEntity.convert(arg)

This static method converts any ansa.base.Entity or any entity within a container (list,tuple,np.array,dict). All other container elements stay untouched!

ansa_entity = ansa.base.Entity(deck=base.CurrentDeck(), id=1, type="GRID")
qd_entity = QDEntity.convert(ansa_entity)

entity_list = [ansa_entity,"YAY"]
entity_list = QDEntity.convert(entity_list) # "YAY" stays untouched

entity_dict = { ansa_entity._id : ansa_entity } # some dictionary
entity_dict= QDEntity.convert(ansa_entity) # converts keys/values if ansa entity

QDEntity.collect(search_type, container=None, deck=base.CurrentDeck(), **kwargs)

This static method is a wrapper for ansa.base.CollectEntities. It's a little more comfortable, since it does not require as many arguments. The Entities are returned as QDEntity.

qd_entities = QDEntity.collect("FACE")

QDEntity.get(search_type, element_id, deck=base.CurrentDeck(), **kwargs)

This static method is a wrapper for ansa.base.GetEntity. One may get an entity from its type and id.

qd_entity_face = QDEntity.get("FACE", 1)

QDEntity(entity, deck=None)

Constructor of a QDEntity from an ansa.base.Entity. Deck can be specified with ansa.constants and uses base.CurrentDeck() if not specified.

ansa_entity = ansa.base.Entity(deck=base.CurrentDeck(), id=1, type="GRID")
qd_entity = QDEntity(ansa_entity)

QDEntity.__len__()

Overloaded len operator. Returns the number of cards of the entity.

len(qd_entity)
# >>> 7

QDEntity.__getitem__(key)

Oerloaded [] operator. Any card in the entity can now be accessed like a dictionary. The argument may be either a str or a list(str). In the second case a list is returned.

qd_entity["TYPE"] # entity is a mesh node
# >>> 'GRID'
qd_entity["NID"]
# >>> 1
qd_entity["TYPE","NID"] # also lists work
# >>> ['GRID',1]

# everyone loves meaningful error messages :)
qd_entity["TYPE","NID","WRONG_FIELD"]
# >>> KeyError: "Could not find the following keys: ['WRONG_FIELD']"

QDEntity.__setitem__(key, value)

Overloaded [] operator for setting card values.

qd_entity["X1"] # entity is a mesh node
# >>> 0.0
qd_entity["X1"] = 1 # single setter
qd_entity["X1","X2"] = 1,19 # list setter

# intelligent error messages ... that's rare ...
qd_entity["X1","X2","WRONG_FIELD"] = 1,19,"YAY" 
# >>> KeyError: "Could not set the following cards: ['WRONG_FIELD']"

QDEntity.__iter__()

Overlaoded operator for loops. With this, one can iterate over the ansa.base.Entity and gets card names and values as pair.

for card_name,card_value in qd_entity:
    print("%s : %s" % (card_name,card_value) )
# >>> 'TYPE' : 'GRID'
# >>> 'NID' : 1
# >>> ...

QDEntity.collect(search_type, deck=self.myDeck, **kwargs)

Same as collect entities, but the container is the instance itself. For the generic collect, call the static function from the class, not the instance.

qd_entities = QDEntity.collect("FACE") # static function collect
face = qd_entities[0] # choose first face
face_grids = face.collect("GRID") # collect GRIDS of face only!

QDEntity.cards() or QDEntity.keys()

Get all the card values of an entity as a list of str.

qd_entity.cards() # this qd_entity is a "NODE"
# >>> ['TYPE', 'NID', ... ] 

QDEntity.values()

Get all the values for the cards as a list of objects.

qd_entity.values() # this qd_entity is a "NODE"
# >>> ['GRID', 1, ... ]

QDEntity.set_deck(deck)

Set the deck of the entity. Use ansa.constants.

qd_entity.set_deck(ansa.constants.ABAQUS)

QDEntity.user_edit()

Pops up the card of the entity, so that the user can edit it. Returns, whether the user pressed ok (True) or not (False).

qd_entity = QDEntity.get("FACE",1)
qd_entity.user_edit() # pops up the dialog
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].