Hi @xieman790
for a select all option in api I think you could to use the predicate manager, and boolean operations such as example:
SetLocale("en-us") Set Synergy = CreateObject("synergy.Synergy") Synergy.SetUnits "Metric" Set Synergy = CreateObject("synergy.Synergy") Set StudyDoc = Synergy.StudyDoc() Set LayerManager = Synergy.LayerManager() Set EntList = LayerManager.CreateEntityList() Set PredicateManager = Synergy.PredicateManager() Set Predicate1 = PredicateManager.CreateLabelPredicate("N1:") Set Predicate2 = PredicateManager.CreateLabelPredicate("TE1:") Set PredicateAll = PredicateManager.CreateBoolOrPredicate( Predicate1, Predicate2 ) EntList.SelectFromPredicate PredicateAll
Then add up the different enties needed from entity prefixes such as:
Hope this helps.
Regards,
Berndt
Hi,
Thanks very much for your reply. Thanks.
For your scripts, it can realize select all, very perfect.
However, another question, how to select all about that visible? Or select by layer?
I want to remesh the triangles that belong to ont layer, is that can be realized? I try to develop a script like below (use 1mm to remesh the L1).
But it didn't work. Could you help me to find where have a mistake? Thanks very much.
SetLocale("en-us")
Set Synergy = CreateObject("synergy.Synergy")
Synergy.SetUnits "Metric"
Set StudyDoc = Synergy.StudyDoc()
Set LayerManager = Synergy.LayerManager()
Set EntList = LayerManager.CreateEntityList()
Set PredicateManager = Synergy.PredicateManager()
Set Predicate1 = PredicateManager.CreateLabelPredicate("L1")
EntList.SelectFromPredicate Predicate1
MeshEditor.RemeshArea2 EntList, 1, True, 0.5
Best wish
Hi @xieman790
using predicate L1 is not selecting entities on layer.
You need to use this to select all mesh triangles
Set Predicate1 = PredicateManager.CreateLabelPredicate("T1:")
Then from triangle entity list check the layer name and build a new list to use for the remesh.
Not very fast, but should do the job.
Regards,
Berndt
Hello, Berndt,
Thanks very much for your quickly reply.
But I still don't know how to do that, could you make a example? Remesh the Triangles that belong to "layer 03"?
Thanks very much for you help.
Hi @xieman790
I coded an example:
'@ '@ Note: The script/macro is provided 'as-is' and cannot be liable for any problems caused. '@ '@ This script select all Triangles, '@ and sort out entities on Layer name "Layer_03", and add them to list called Layer_List. '@ The layer "Layer_03" triangles are then remeshed '@ '@ NOTES '@ Date Comment '@ 2016-01-08 B.Nordh SetLocale("en-us") Set Synergy = CreateObject("synergy.Synergy") Synergy.SetUnits "Metric" Set StudyDoc = Synergy.StudyDoc() Set LayerManager = Synergy.LayerManager() Set EntList = LayerManager.CreateEntityList() Set MeshEditor = Synergy.MeshEditor() Set EntList2 = MeshEditor.CreateEntityList() '--- Get specified entities in study 'Nodes: N 'Beams: B 'Triangles: T 'Tetrahedral elements: TE 'Curves: C 'Surfaces: S 'Regions: R 'STL envelopes: STL 'Nodal boundary conditions: NBC 'Surface/element boundary conditions: SBC 'Local coordinate systems: LCS Set PredicateManager = Synergy.PredicateManager() Set PredicateTri = PredicateManager.CreateLabelPredicate("T1:") EntList.SelectFromPredicate PredicateTri EntListSize = EntList.Size 'MsgBox "Number of entities: " & EntListSize,,"Information" '--- Sort out Entities on specific layer LayerName = "Layer_03" Entities_in_List = 0 For J = 0 To EntListSize-1 Set Entity = EntList.Entity(J) Set EntityLayer = StudyDoc.GetEntityLayer(Entity) LName = LayerManager.GetName(EntityLayer) If (LName = LayerName) Then Entities_in_List = Entities_in_List + 1 Layer_List = Layer_list + " " + Entity.ConvertToString End If Next EntList2.SelectFromString Layer_List MsgBox "Number of entities selected: > " & EntList2.Size & " < on layer : " & LayerName,,"Information" MeshEditor.RemeshArea2 EntList2, 1, True, 0.5 MsgBox "Script completed.",,"Information"
This does the job.
On a large mesh it will take a while to find the triangles to remesh.
Hope this helps.
Regards,
Berndt