Continue to Site

Welcome to 3DCADForums

Join our CAD community forums where over 25,000 users interact to solve day to day problems and share ideas. We encourage you to visit, invite you to participate and look forward to your input and opinions. Acrobat 3D, AutoCAD, Catia, Inventor, IronCAD, Creo, Pro/ENGINEER, Solid Edge, SolidWorks, and others.

Ghost elements

Question...

I'm having troubles with a large number elements present on 1 layer...
The layer ount shows them to be there, but I can't see them. The elements aren't hidden.
If I fit my view, my model is thrown so far back I can't see it anymore. (so there must be objects present which are far away from my model)

I've performed a part cleanup (delete empty groups,delete unused objects,delete unused fonts, etc) but this doesn't make a difference. The objects are still there.
If I have fitted my view and try to delete them, it says no objects selected.

I'm at a loss :confused: ..Anybody have a solution for this? How do I get ridd of these ghost objects...
 
Try a couple of things

There are several reasons why your elements may be hidden. You say they are on layer 1, so it's not a layer issue, but they could also be blanked. There are several commands that automatically blank entities.

Try this:

SAVE YOUR FILE

On you Keyboard, HIT Control-Shift and U (This is a shortcut for unblank all).

If that did not work, the entities may be hidden, look at your part navigator and see if you find a bunch of grayed out entities. If so, RMB on these and select show.

Hope one of these helps

Jim Rawlinson
Sr. Engineer CAD/PLM Support
Goodrich SIS California
 
There are several reasons why your elements may be hidden. You say they are on layer 1, so it's not a layer issue, but they could also be blanked. There are several commands that automatically blank entities.

Try this:

SAVE YOUR FILE

On you Keyboard, HIT Control-Shift and U (This is a shortcut for unblank all).

If that did not work, the entities may be hidden, look at your part navigator and see if you find a bunch of grayed out entities. If so, RMB on these and select show.

Hope one of these helps

Jim Rawlinson
Sr. Engineer CAD/PLM Support
Goodrich SIS California


Thanx Jim...

Like I said the objects aren't invisible.They also aren't blanked.
As far as I can tell they originated from an imported / converted DXF. Apperently this action inherets some objects which NX doesn't know how to handle..

I have found a script to remove everything from a layer including these so called "Ghost Elements"

Watch out!! everything is removed, so place everything you want to keep on another layer..
Code needs to be compiled within an NX project in C++

Code:
/*HEAD DELETE_ALL_OBJECTS_ON_LAYER CCC UFUN */
#include <stdio.h>
#include <string.h>
#include <uf.h>
#include <uf_ui.h>
#include <uf_layer.h>
#include <uf_obj.h>
#include <uf_modl.h>

#define UF_CALL(X) (report_error( __FILE__, __LINE__, #X, (X)))

static int report_error( char *file, int line, char *call, int irc)
{
    if (irc)
    {
        char err[133],
             msg[133];

        sprintf(msg, "*** ERROR code %d at line %d in %s:\n+++ ",
            irc, line, file);
        UF_get_fail_message(irc, err);

    /*  NOTE:  UF_print_syslog is new in V18 */

        UF_print_syslog(msg, FALSE);
        UF_print_syslog(err, FALSE);
        UF_print_syslog("\n", FALSE);
        UF_print_syslog(call, FALSE);
        UF_print_syslog(";\n", FALSE);

        if (!UF_UI_open_listing_window())
        {
            UF_UI_write_listing_window(msg);
            UF_UI_write_listing_window(err);
            UF_UI_write_listing_window("\n");
            UF_UI_write_listing_window(call);
            UF_UI_write_listing_window(";\n");
        }
    }

    return(irc);
}

static void set_layer_active(int layer)
{
    UF_CALL(UF_LAYER_set_status(layer, UF_LAYER_ACTIVE_LAYER));
}

static int allocate_memory(unsigned int nbytes, void **where)
{
    int
        resp;

    *where = UF_allocate_memory(nbytes, &resp);

    return resp;
}

static int make_an_array(uf_list_p_t *object_list, tag_t **objects)
{
    int
        ii,
        n;
    uf_list_p_t
        temp;

    UF_CALL(UF_MODL_ask_list_count(*object_list, &n));

    UF_CALL(allocate_memory(n * sizeof(tag_t), (void **)objects));

    for (ii = 0, temp = *object_list; ii < n; temp = temp->next, ii++)
        (*objects)[ii] = temp->eid;

    UF_CALL(UF_MODL_delete_list(object_list));

    return n;
}

static int ask_all_objects_on_layer(int layer, tag_t **objects)
{
    tag_t
        object = NULL_TAG;
    uf_list_p_t
        list;

    UF_CALL(UF_MODL_create_list(&list));

    while (!UF_CALL(UF_LAYER_cycle_by_layer(layer, &object)) &&
        (object != NULL_TAG)) UF_CALL(UF_MODL_put_list_item(list, object));

    return make_an_array(&list, objects);
}

#ifndef UF_LAYER_MAX_LAYER
    #define UF_LAYER_MAX_LAYER 256
#endif

static logical prompt_for_a_layer(char *prompt, char *item, int *number)
{
    int
        irc,
        resp;
    char
        laymsg[100],
        menu[1][16];
    int
        da[1];

    strcpy(&menu[0][0], item);
    da[0] = *number;

    resp = uc1607(prompt, menu, 1, da, &irc);
    if (resp == 3 || resp == 4)
    {
        *number = da[0];
        if ((*number > UF_LAYER_MAX_LAYER) || (*number <= 0))
        {
            sprintf(laymsg, "Layers range from 1 to %d", UF_LAYER_MAX_LAYER);
            uc1601(laymsg, TRUE);
            return prompt_for_a_layer(prompt, item, number);
        }
        return TRUE;
    }
    else return FALSE;
}

static void do_it(void)
{
    int
        layer = 1,
        n_objs;
    tag_t
        *objs;
    char
        messg[133];

    while (prompt_for_a_layer("Delete objects from", "Layer", &layer))
    {
        set_layer_active(layer);

        n_objs = ask_all_objects_on_layer(layer, &objs);
        if (n_objs > 0)
        {
            UF_CALL(UF_OBJ_delete_array_of_objects(n_objs, objs, NULL));
            UF_free(objs);
        }
        else
        {
            sprintf(messg, "\nNo objects found on layer %d",layer);
            uc1601(messg,1);
        }
    }
}

/*ARGSUSED*/
void ufusr(char *param, int *retcode, int paramLen)
{
    if (UF_CALL(UF_initialize())) return;
    do_it();
    UF_terminate();
}

int ufusr_ask_unload(void)
{
    return (UF_UNLOAD_IMMEDIATELY);
}
 

Articles From 3DCAD World

Sponsor

Back
Top