找回密码 注册 QQ登录
开思网工业级高精度在线3D打印服务

iCAx开思网

CAD/CAM/CAE/设计/模具 高清视频【积分说明】如何快速获得积分?在线3D打印服务,一键上传,自动报价 
查看: 17044|回复: 0
打印 上一主题 下一主题

问个NX OPEN for C++二次开发中Vector的问题:

[复制链接]
跳转到指定楼层
1
发表于 2007-7-3 10:36:27 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多同行朋友,交流,分享,学习。

您需要 登录 才可以下载或查看,没有帐号?注册

x
先看看代码:
    NXOpen::Features::FeatureCollection* f_collection = thePart->Features();
    for (NXOpen::Features::FeatureCollection::iterator it=f_collection->begin();it != f_collection->end();it++)
    {
        NXOpen::Features::Feature* f11= (NXOpen::Features::Feature* ) *it;
        std::vector<NXOpen::Features::Feature*> f_v;
        f_v=f11->GetChildren();
        if (f_v.size() > 0)
        {
            for (std::vector<NXOpen::Features::Feature*>::iterator it_sub=f_v.begin();
                it_sub!=f_v.end();it_sub++)
            {
                NXOpen::Features::Feature* f22= (NXOpen::Features::Feature* ) *it;
            }

        }
    }
我的目的是想把getChildren()函数所返回的vector取出来,存在另一个声明的名为f_v的vector中。第一个for循环执行的没有大问题,为什么在赋值时以及使用vector的size等函数时就出错?提示说是Access Violation?
其中,getChildren的函数说明如下:

std::vector<NXOpen::Features::Feature *> NXOpen::Features::Feature::GetChildren  (    )   

   Returns the immediate child features.

问题是现在运行到    f_v=f11->GetChildren();
这一句时,就报错了,在Log里看到说是Access Violation
++++ Fatal system exception: c0000005 Access Violation
[ 1] 148817FD xutility\std::_Container_base::_Orphan_all Line 197 +0x3d    (MSVCP80D)
[ 2] 14418F87 vector\std::vector<NXOpen::Features::Feature *,std::allocator<NXOpen::Features::Feature *> >::_Tidy Line 1092 +0x37 (Demo2)
[ 3] 14417921 vector\std::vector<NXOpen::Features::Feature *,std::allocator<NXOpen::Features::Feature *> >::~vector<NXOpen::Features::Feature *,std::allocator<NXOpen::Features::Feature *> > Line 547 +0x51

哪位大侠看看是啥问题啊? 急!
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 赞一下!赞一下!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

3D打印手板模型快速制作服务,在线报价下单!

QQ 咨询|手机版|联系我们|iCAx开思网  

GMT+8, 2024-9-22 09:37 , Processed in 0.019496 second(s), 10 queries , Gzip On, Redis On.

Powered by Discuz! X3.3

© 2002-2024 www.iCAx.org

快速回复 返回顶部 返回列表