Cancel
Showing results for 
Search instead for 
Did you mean: 

Create Layers From Groups - API Issue

Pioneer
Pioneer

Hi I am using the  following Code to create layers from the Groups. I am using Femap 10.0.2

I am facing the error "Basic Error (Line 14, Offset 0): (10094) ActiveX Automation: Object var is 'Nothing'. "

Can you please help me on this

 

API

====

Sub Main
    Dim App As femap.model
    Set App = feFemap()
    Dim feGroup As femap.Group
    Dim feSet As femap.Set
    Dim feLayer As femap.layer
    Dim rc As Long
    Dim numID As Long, arrayID As Variant

    Set geGroup=App.feGroup
    Set feSet=App.feSet
    Set feLayer=App.feLayer

    While feGroup.Next

    feLayer.ID=feGroup.ID
    feLayer.color=FCL_AQUAMARINE
    feLayer.title=feGroup.title
    feLayer.Put (feLayer.ID)

    rc=feSet.AddGroup( FT_POINT, feGroup.ID)
    rc=App.feModifyLayer( FT_POINT, feSet.ID, feLayer.ID)
    feSet.Clear

    rc=feSet.AddGroup( FT_CURVE, feGroup.ID)
    rc=App.feModifyLayer( FT_CURVE, feSet.ID, feLayer.ID)
    feSet.Clear

    rc=feSet.AddGroup( FT_SURFACE, feGroup.ID)
    rc=App.feModifyLayer( FT_SURFACE, feSet.ID, feLayer.ID)
    feSet.Clear

    rc=feSet.AddGroup( FT_NODE, feGroup.ID)
    rc=App.feModifyLayer( FT_NODE, feSet.ID, feLayer.ID)
    feSet.Clear

    rc=feSet.AddGroup( FT_ELEM, feGroup.ID)
    rc=App.feModifyLayer( FT_ELEM, feSet.ID, feLayer.ID)
    feSet.Clear

    feLayer.Put (feLayer.ID)
    Wend

End Sub

4 REPLIES

Re: Create Layers From Groups - API Issue

Experimenter
Experimenter

Fix variable name in this line:

 

Set geGroup=App.feGroup

Re: Create Layers From Groups - API Issue

Pioneer
Pioneer

Thank you Andrey. Perfect

Re: Create Layers From Groups - API Issue

Pioneer
Pioneer

Can we create teh Layers from Group..??

what is the Equivalent API for this    rc=feSet.AddGroup( FT_POINT, feGroup.ID)

Re: Create Layers From Groups - API Issue

Siemens Phenom Siemens Phenom
Siemens Phenom

The method ".AddGroup" will add all entities of a specific type within a group to Set Object "feSet".

 

Are you looking to add all entities of a specific type within a layer to a Set Object?  The method ".AddEntitiesOnLayer" will do this.

 

If you are looking to add all entities in a Group to a Layer, the application object method ".feGroupMoveToLayer" is probably what you are looking for.