iCAx开思工具箱

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 25169|回复: 0
打印 上一主题 下一主题

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

[复制链接]
跳转到指定楼层
楼主
发表于 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|小黑屋|手机版|开思工具箱 CAD工具箱_CAM工具箱  

GMT+8, 2024-9-28 10:20 , Processed in 0.013187 second(s), 6 queries , Gzip On, Redis On.

Powered by Discuz! X3.3

© 2002-2024 www.iCAx.org

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