??xml version="1.0" encoding="utf-8" standalone="yes"?>狼狼综合久久久久综合网,Xx性欧美肥妇精品久久久久久,69久久夜色精品国产69 http://www.shnenglu.com/eryar/category/20246.htmlPipeCAD - Plant Piping Design Software. <br> RvmTranslator - Translate AVEVA RVM to OBJ, glTF, etc.zh-cnSun, 18 Jun 2023 10:38:22 GMTSun, 18 Jun 2023 10:38:22 GMT60Licensecc-C++ License Managerhttp://www.shnenglu.com/eryar/archive/2023/06/18/licensecc.htmleryareryarSun, 18 Jun 2023 05:01:00 GMThttp://www.shnenglu.com/eryar/archive/2023/06/18/licensecc.htmlhttp://www.shnenglu.com/eryar/comments/229933.htmlhttp://www.shnenglu.com/eryar/archive/2023/06/18/licensecc.html#Feedback0http://www.shnenglu.com/eryar/comments/commentRss/229933.htmlhttp://www.shnenglu.com/eryar/services/trackbacks/229933.htmlLicensecc-C++ License Manager

eryar@163.com

 

Licensecc: a C++ software license manager。用Licensecc可以l开发的软g加上保护Q限制Y件的使用。通过授权控制来限制Y件的使用Q也可以限制软g的用时_(d)?qing)限制Y件在指定机器上运行。Licensecc是基于BSD协议开源的软g授权pȝ用来帮助你的软g闭源。Licensecc使用C++ 11开发,支持跨^C用?/p>

 

Licensecc主要功能列表Q?/p>

Issue a “demo” license with only expiry date.

支持试用许可功能Q不l定具体的机器,但是限制使用旉或者其他限制?/p>

Licenses linked to “physical” hardware id

l定机器的许可功能:(x)让Y件绑定机器硬Ӟ只能在授权的机器上运行?/p>

旉限制

 

盘I(y)D限制

 

IP地址限制

 

CPU限制

 

对于一些小的YӞ可以使用licensecc来加上license对Y件进行保护?/p>

 



eryar 2023-06-18 13:01 发表评论
]]>
PmuReviewer Previewhttp://www.shnenglu.com/eryar/archive/2021/04/06/PmuReviewer_Preview.htmleryareryarTue, 06 Apr 2021 15:21:00 GMThttp://www.shnenglu.com/eryar/archive/2021/04/06/PmuReviewer_Preview.htmlhttp://www.shnenglu.com/eryar/comments/217655.htmlhttp://www.shnenglu.com/eryar/archive/2021/04/06/PmuReviewer_Preview.html#Feedback0http://www.shnenglu.com/eryar/comments/commentRss/217655.htmlhttp://www.shnenglu.com/eryar/services/trackbacks/217655.htmlPmuReviewer Preview

eryar@163.com

 

Intergraph鹰图公司的SmartPlant3D可以导出VUE文g用于模型审查ReivewQ和AVEVA公司的PDMS可以导出RVM文g一栗这些文件中包含?jin)模型的几何信息及(qing)部分属性信息,方便模型审查Q提高设计效率。在数字化工厂、智能工厂、数字化交付的趋势下Q通过解析q些数据文gQ获取其中的模型信息Q能为数字化交付q_提供数据基础?/p>

AVEVA公司的PDMS导出的RVM文gQ其l构单,解析相对Ҏ(gu)。早在几q之前,已经实现RVM文g数据的完全解析,q实C品RvmTranslator?/p>

 

上图所CZؓ(f)船舶Marine模块导出的船舶设计模型?/p>

 

上图所CZؓ(f)工厂Plant模块导出的工厂设计模型?/p>

Intergraph公司的VUE文g相对复杂Q可以浏览VUE文g的YӞ除了(jin)自家产品Intergraph Reivew和Intergraph FreeView{之外,q有Autodesk公司的Navisworks Manage有导入VUE的插件。如果能直接支持对VUE文g的解析,对完善数字化交付?sh)品U有重要意义Q即能同时支持国际两个主工E设计Y件的数据。ؓ(f)?jin)在数字化交付、数字化工厂中A(ch)献我们的力量Q我们开始了(jin)对VUE文g的解析工作,q取得了(jin)重大q展。现AVEVA的RVM模型文g览和Intergraph的VUE文g览集成一个三l环境,命名为PmuReviewerQ即工厂模型审查E序。现在程序已l能处理大部分模型及(qing)模型颜色信息?nbsp;

上图所CZؓ(f)Intergraph FreeView中显C的VUE模型?nbsp;

 

上图所CZؓ(f)PmuReviewer中显C的模型Q有讑֤、管道、管道焊~、阀门、结构、梯子模型等?/p>

E序采用Ribbon风格界面Q暂时只支持RVM和VUE的浏览,后箋(hu)?x)加入其他功能,如尺寸测量,模型剖切{?/p>

 


Z(jin)方便大家在移动端也能看到我的博文和讨Z,现已注册微信公众PƢ迎大家扫描下方二维码关注?/h5> Shing Liu(eryar@163.com)


eryar 2021-04-06 23:21 发表评论
]]>Qt Python Scriptable Application http://www.shnenglu.com/eryar/archive/2020/02/24/QtScriptableApplication.htmleryareryarMon, 24 Feb 2020 06:56:00 GMThttp://www.shnenglu.com/eryar/archive/2020/02/24/QtScriptableApplication.htmlhttp://www.shnenglu.com/eryar/comments/217155.htmlhttp://www.shnenglu.com/eryar/archive/2020/02/24/QtScriptableApplication.html#Feedback0http://www.shnenglu.com/eryar/comments/commentRss/217155.htmlhttp://www.shnenglu.com/eryar/services/trackbacks/217155.html
Key Words. Qt, Python, Shiboken2, PySide2  阅读全文

eryar 2020-02-24 14:56 发表评论
]]>
Installing Node.js and Express on Ubuntuhttp://www.shnenglu.com/eryar/archive/2019/07/08/Ubuntu_Nodejs.htmleryareryarMon, 08 Jul 2019 04:10:00 GMThttp://www.shnenglu.com/eryar/archive/2019/07/08/Ubuntu_Nodejs.htmlhttp://www.shnenglu.com/eryar/comments/216511.htmlhttp://www.shnenglu.com/eryar/archive/2019/07/08/Ubuntu_Nodejs.html#Feedback0http://www.shnenglu.com/eryar/comments/commentRss/216511.htmlhttp://www.shnenglu.com/eryar/services/trackbacks/216511.htmlInstalling Node.js and Express on Ubuntu

1. 在nodejs官网上下载Linux Binaries(已经包含?jin)npm):

2. 安装Node.js
下蝲后解压,q在解压的文件夹中启动Terminal后,输入命o(h)Q?br />    sudo cp * /usr/local/ -r
再输入命令:(x)
    node -v
    npm -v
查看E序版本Q来(g)是否成功安装:(x)


3. 安装express
    npm install -g express-generator

4. 试Node和Express
用Cesium来测试一下安装是否成功,q入到Cesium源码文g夹,输入命o(h)Q?br />Node server.js


表示启动成功Q在览器中输入|址Qhttp://localhost:8080/


点击链接Hello World出现下面的这个地球:(x)





eryar 2019-07-08 12:10 发表评论
]]>
Boost test vs2013 fatal error C1001http://www.shnenglu.com/eryar/archive/2019/07/06/boost_test.htmleryareryarSat, 06 Jul 2019 04:54:00 GMThttp://www.shnenglu.com/eryar/archive/2019/07/06/boost_test.htmlhttp://www.shnenglu.com/eryar/comments/216504.htmlhttp://www.shnenglu.com/eryar/archive/2019/07/06/boost_test.html#Feedback0http://www.shnenglu.com/eryar/comments/commentRss/216504.htmlhttp://www.shnenglu.com/eryar/services/trackbacks/216504.htmlBoost test vs2013 fatal error C1001

?span style="font-family: 'Times New Roman';">Visual Studio 2013中?/span>boost?/span>test模块时会(x)报致命错误,如下图所C:(x)

输出报错信息如下Q?/p>

1>------ Build started: Project: Test, Configuration: Debug Win32 ------

1>  main.cpp

1>d:\boost_1_70_0\boost\type_traits\common_type.hpp(47): fatal error C1001: An internal error has occurred in the compiler.

1>  (compiler file 'msc1.cpp', line 1325)

1>   To work around this problem, try simplifying or changing the program near the locations listed above.

1>  Please choose the Technical Support command on the Visual C++ 

1>   Help menu, or open the Technical Support help file for more information

========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

 

定位到报错文件是common_type.hppQ?/span>

 

可以看出是因为CXX11的原因,因ؓ(f)VS2013不支?/span>C++11Q所?/span>boost提供?jin)一个宏定义来设|是否支?/span>CXX11Q?/span>

BOOST_NO_CXX11_TEMPLATE_ALIASES

在Project->Properties->C/C++->Preprocessor中设|即可:(x)

 

 


Z(jin)方便大家在移动端也能看到我的博文和讨Z,现已注册微信公众PƢ迎大家扫描下方二维码关注?/h5>Shing Liu(eryar@163.com)


eryar 2019-07-06 12:54 发表评论
]]>
QString::toStdString() crasheshttp://www.shnenglu.com/eryar/archive/2019/01/17/std_string_crash.htmleryareryarThu, 17 Jan 2019 13:50:00 GMThttp://www.shnenglu.com/eryar/archive/2019/01/17/std_string_crash.htmlhttp://www.shnenglu.com/eryar/comments/216209.htmlhttp://www.shnenglu.com/eryar/archive/2019/01/17/std_string_crash.html#Feedback0http://www.shnenglu.com/eryar/comments/commentRss/216209.htmlhttp://www.shnenglu.com/eryar/services/trackbacks/216209.html今天在Qt中开发程序时Q遇C个QString::toStdString()的内存问题,用法如下Q?/p>
void test(const QString& theFileName)
{
    std::string aFileName = theFileName.toStdString();
    std::ofstream aFile(aFileName);
    aFile << aFileName;
}

在函数还没执行完崩溃了(jin)Q跟t发现是std::string的问题。最后发现是因ؓ(f)引用的库的Runtime Library不同D的,一个是MDdQ一个是MTdQ后来改成一致即可?/p>



eryar 2019-01-17 21:50 发表评论
]]>
Consolas 字体http://www.shnenglu.com/eryar/archive/2019/01/15/Consolas.htmleryareryarTue, 15 Jan 2019 08:53:00 GMThttp://www.shnenglu.com/eryar/archive/2019/01/15/Consolas.htmlhttp://www.shnenglu.com/eryar/comments/216204.htmlhttp://www.shnenglu.com/eryar/archive/2019/01/15/Consolas.html#Feedback0http://www.shnenglu.com/eryar/comments/commentRss/216204.htmlhttp://www.shnenglu.com/eryar/services/trackbacks/216204.html

概述

q套字型使用?jin)微软的ClearType 字型qx(chng)技术,q同W(xu)indows Vista、Office 2007?qing)Microsoft Visual Studio中发行,或可在微软的|站下蝲。在Windows Vista?套新字型中,Consolasq似于前版Windows??Ƒֆ建字型:(x)Lucida Console与Courier NewQ主要ؓ(f)E序代码的显C字型而设计的Q特别之处是它的“0”字加入了(jin)一斜撇Q以方便与字?#8220;O”分L? 在Consolas之前Q程序代码的昄字型大多为Courier New或其他等宽字型,字型的柔边(反锯齿)(j)效果则依个h喜好选择开启或关闭Q然而Consolas是专为柔Ҏ(gu)果而设计的字型Q特别是Z(jin)搭配微Y的ClearType技术,如果不开启ClearTypeQConsolas的显C效果会(x)打大折扣。另外,ClearType技术还需要搭配液晶显C器才会(x)有最佌现?

应用

传统上,E式~写员在Windows环境底下Q一般都?x)用Courier New或其他近似的{宽字体来显C程序代码。通常用来~写E序代码的程序都?x)让~程员选择用来昄E序代码的字体。由于Courier New的字型比较肥大,使每个画面或面所能显C的E序代码大ؓ(f)减少。Consolas除了(jin)能够在较?yu)的I间昄更多的内容,它的清晰字型亦ɾ~程员能够更快捷的分辨每一个文字?br />
q个字体用来~码很清晎ͼ舒服Q主要是数字0和字?可以Ҏ(gu)的区别出来,q里做个备忘Q方便在~码环境中设|这个字体?img src ="http://www.shnenglu.com/eryar/aggbug/216204.html" width = "1" height = "1" />

eryar 2019-01-15 16:53 发表评论
]]>
qmake生成Visual Studio工程 http://www.shnenglu.com/eryar/archive/2018/09/30/qmake.htmleryareryarSun, 30 Sep 2018 05:49:00 GMThttp://www.shnenglu.com/eryar/archive/2018/09/30/qmake.htmlhttp://www.shnenglu.com/eryar/comments/215984.htmlhttp://www.shnenglu.com/eryar/archive/2018/09/30/qmake.html#Feedback0http://www.shnenglu.com/eryar/comments/commentRss/215984.htmlhttp://www.shnenglu.com/eryar/services/trackbacks/215984.html 

整个Qt在Windows中都可以通过批处理来~译Q当~译好Qt后,?x)生成qmake.exe?/p>

在没有安装Qt-VS-Addin的情况下Q如何用别人提供的Qt *.pro目文g呢?

使用qmake可以直接生成Visual Studio目文gQ命令如下:(x)

qmake -tp vc


如果不成功,可能q需要配|QMAKESPECQ?/p>

set QMAKESPEC=win32-msvc2015


从Visual Studio的菜单启动VS命o(h)H口Q可以把qmakeE序的\径设|到环境变量PATH中,再切换到*.pro文g所在目录,使用qmake命o(h)。如果需要递归处理所?.pro文gQ可以加?recursive选项。完整内容如下:(x)

set PATH=%PATH%;D:/Qt5.8.0/bin;
set QMAKESPEC=win32-msvc2015
qmake -tp vc -recursive
nmake

 



eryar 2018-09-30 13:49 发表评论
]]>
CesiumJS - 3D Tiles BIMhttp://www.shnenglu.com/eryar/archive/2018/08/24/CesiumJS-BIM.htmleryareryarFri, 24 Aug 2018 13:12:00 GMThttp://www.shnenglu.com/eryar/archive/2018/08/24/CesiumJS-BIM.htmlhttp://www.shnenglu.com/eryar/comments/215873.htmlhttp://www.shnenglu.com/eryar/archive/2018/08/24/CesiumJS-BIM.html#Feedback0http://www.shnenglu.com/eryar/comments/commentRss/215873.htmlhttp://www.shnenglu.com/eryar/services/trackbacks/215873.htmlCesiumJS - 3D Tiles BIM

eryar@163.com

1. Introduction

CesiumJS is an open-source JavaScript library for world-class 3D globes and maps. 

wps_clip_image-27753

从其官网上可以看到这个库的愿景:(x)成ؓ(f)世界U的三维地图。由于其高性能Q对大模型的优化技术,可以用于BIM。支持Cesium的胦(ch)团里面就有Bentley。Bentley也有工厂CAD软g?/p>

2. Node.js

从nodejs官网https://nodejs.org/en/download/上下载安装包Q如果没有安装权限,可以下蝲免安装的打包文gQ?/p>

wps_clip_image-27908

直接解压到d:/nodejs。ƈ在此文g夹中创徏两个文g夹:(x)node_global, node_cacheQ如下图所C:(x)

wps_clip_image-15261

然后使用CMDH口Q切换到d:/nodejs目录Q输入如下命令来讄global和cacheQ?/p>

npm config set prefix “d:/nodejs/node_global”
npm config set cache “d:/nodejs/node_cache”

q修改nodevars.bat中的环境变量Q?/p>

wps_clip_image-24391

q运行nodevars.bat?/p>

安装CesiumJS所需要的插gQ?/p>

npm install compression -g
npm install request -g
npm install yargs -g

 

3. CesiumJS Hello World

在CMD命o(h)H口中切换到Cesium文g夹,q输入命令:(x)

Node server.js

出现如下图所C的 Cesium development server running locally.

表示Cesium可以在本地运行了(jin)?/p>

wps_clip_image-981

在浏览器中输入地址Qhttp://localhost:8080Q出现如下图所C页面:(x)

wps_clip_image-28088

点击HelloWorld链接Q出现如下图所C的的一个三l地球就表示Cesium安装成功?jin)?/p>

wps_clip_image-22233

4. 3D Tiles BIM Demo

在Cesium的官|上有Bentley提供的一个工厂BIM模型例子Q可以从如下地址查看Q?/p>

https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/index.html?src=3D%20Tiles%20BIM.html

wps_clip_image-24263

 

从其官方的介l来看,Cesium使用?D Tiles技术可以对三维模型数据q行压羃?qing)其他优化技术,使其可以加蝲很大的模型的情况下,览畅。且3D Tiles格式也是开源的Q可以学?fn)借鉴?/p>

5. Conclusion

本文介绍?jin)CesiumJSq个JavaScript库的安装和配|,q展CZ(jin)其在BIM中的一个应用例子。可以通过学习(fn)CesiumJS来将PDMS模型转换?D Tiles格式Q来试其对大模型的支持效果?/p>


Z(jin)方便大家在移动端也能看到我的博文和讨Z,现已注册微信公众PƢ迎大家扫描下方二维码关注?/h5>Shing Liu(eryar@163.com)


eryar 2018-08-24 21:12 发表评论
]]>
QCAD Plugin 开?/title><link>http://www.shnenglu.com/eryar/archive/2018/06/21/QCAD_Plugin.html</link><dc:creator>eryar</dc:creator><author>eryar</author><pubDate>Thu, 21 Jun 2018 15:28:00 GMT</pubDate><guid>http://www.shnenglu.com/eryar/archive/2018/06/21/QCAD_Plugin.html</guid><wfw:comment>http://www.shnenglu.com/eryar/comments/215735.html</wfw:comment><comments>http://www.shnenglu.com/eryar/archive/2018/06/21/QCAD_Plugin.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/eryar/comments/commentRss/215735.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/eryar/services/trackbacks/215735.html</trackback:ping><description><![CDATA[<h3 style="text-align: center;">QCAD Plugin 开?/h3> <p style="text-align: center;"><a href="mailto:eryar@163.com">eryar@163.com</a></p> <p><strong>Abstract.</strong> QCAD是基于GPL协议的开源CAD软gQ核?j)功能基于Qt使用C++开发,界面?qing)其交互使用Javascript脚本q行开发。QCAD官方推荐开发其Plugin的方式ؓ(f)使用Javascript脚本的方式,因ؓ(f)QCAD的菜单及(qing)其对应的功能全部由Javascript实现。程序有时也需要和C++直接通信Q如在QCAD中用OpenCASCADE。本文主要介l如何来开发QCAD的插件PluginQ从而能够对QCADq行扩展Q做一些定制化的功能开发?/p> <p><strong>Key Words.</strong> QCAD Plugin, Javascript, C++, CAD, 3D</p> <h2>1.Introduction</h2> <p>QCAD是GPL协议的开源CAD软gQ主要用Javascript脚本q行开发,也可使用C++开发。与AutoCAD的多U开发方式一P支持AutoLisp脚本Q也支持ObjectArx使用C++q行开发。不q开源的E序可以q行源码DebugQ遇到问题可以自己动手解冟뀂而AutoCAD是闭源的Q如果是正版用户可以咨询开发厂Ӟ不能q根溯源。对于想学习(fn)CAD的h来说Q徏议可以多看这U开源YӞ学习(fn)CAD的开发原理?/p> <p>本文主要介绍开源Y件QCAD的插件Plugin的开发方法?/p> <h2>2.Javascript</h2> <p>׃QCAD的菜单、交互都提供?jin)Javascript的封装,所以QCAD的大部分功能都是用Javascript脚本实现。Javascript脚本对QCADq行开发也是QCAD作者推荐的方式?/p> <p><a >https://www.qcad.org/doc/qcad/latest/developer/_script_scope.html</a></p> <p>QCADE序框架提供?jin)一很完整的强大的ECMAScript接口QQCAD几乎所有的功能都可以通过脚本JavaScript来访问。ECMAScriptQJavaScriptQ是很流行且易于学习(fn)的一U脚本语a。通过使用JavaScript脚本来扩展QCAD是一U简单高效的方式Q扩展的功能包括交互创徏、修改工L(fng){?/p> <p><a ><img style="background-image: none; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border: 0px;" title="wps_clip_image-21599" src="https://images2018.cnblogs.com/blog/534255/201806/534255-20180621232150404-1238697124.png" alt="wps_clip_image-21599" width="431" height="204" border="0" /></a></p> <p>用户甚至可以ZQCAD的应用框架开发出一个全新的E序。全新的E序可能是一个控制台工具或包含用户交互的CADE序Q?/p> <p><a ><img style="background-image: none; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border: 0px;" title="wps_clip_image-12615" src="https://images2018.cnblogs.com/blog/534255/201806/534255-20180621232150976-1419070353.png" alt="wps_clip_image-12615" width="418" height="196" border="0" /></a></p> <p>如下图所CZؓ(f)QCAD中主要模块的功能。Qt主要涉及(qing)通用的功能,与CAD没有直接关系。QCADE序框架QCAD Application Framework提供CAD专用功能Q如CAD Core, DXF导入导出、强大的囑Ş视图powerful graphics view{等。脚本ECMAScript可以用来快速的扩展CAD专用功能。QCAD用户接口?qing)所有的交互功能、几乎所有的H口都是通过脚本实现的?/p> <p>QCAD包中的qcad.exe是一个ECMAScript解释器,q且装?jin)Qt和QCAD的接口。当没有MECMAScript脚本的时候,q行qcad.exe会(x)什么也不做。Qcad.exe默认?x)查?#8220;scripts/autostart.js”q执行。在QCAD中,autostart.js脚本初始化了(jin)所有的ECMAScript工具和用户交互的功能Qƈ启动ȝ序?/p> <p>QCAD中几乎所有的H口、菜单、工h都是通过ECMAScript脚本实现。这些脚本位于scripts文g夹中?/p> <p><a ><img style="background-image: none; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border: 0px;" title="wps_clip_image-10035" src="https://images2018.cnblogs.com/blog/534255/201806/534255-20180621232151727-1141609498.png" alt="wps_clip_image-10035" width="577" height="167" border="0" /></a></p> <p>用JavaScript脚本开发QCAD插g最好办法就是先在QCAD中创单和工具栏。下面就l出在QCAD中创单和工具栏的步骤。首先要创徏文gl构Q?/p> <p>l 对于新的层菜单Q在QCAD目录中的scripts文g夹中创徏一个新的文件夹。例如:(x)创徏一?#8220;MyScripts”的文件夹Q?/p> <p>l 在MyScripts文g夹中创徏一个文本文?#8220;MyScripts.js”Q?/p> <p>l 在MyScripts文g夹中创徏另外一个文件夹来提供一个命令ActionQ如命名?#8220;MyAction”Q?/p> <p>l 在MyAction文g夹中创徏一个文本文件MyAction.jsQ文件名必须和文件夹的名字一_(d)</p> <p>文gl织l构如下所C:(x)</p> <p><a ><img style="background-image: none; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border: 0px;" title="wps_clip_image-11506" src="https://images2018.cnblogs.com/blog/534255/201806/534255-20180621232152246-1477474323.png" alt="wps_clip_image-11506" width="246" height="130" border="0" /></a></p> <p>如下JavaScript脚本复制到MyScripts.js文g中:(x)</p> <div id="vfbjf9r" class="cnblogs_code"> <pre><span style="color: #008000;">/*</span><span style="color: #008000;">* * Copyright (c) 2011-2018 by Andrew Mustun. All rights reserved. * * This file is part of the QCAD project. * * QCAD is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * QCAD is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with QCAD. </span><span style="color: #008000;">*/</span> <span style="color: #008000;">//</span><span style="color: #008000;"> MyScripts.js</span><span style="color: #008000;"> //</span><span style="color: #008000;"> All actions are derived from class EAction, so we need to </span><span style="color: #008000;"> //</span><span style="color: #008000;"> include this class definition here:</span> include("../EAction.js"<span style="color: #000000;">); </span><span style="color: #008000;">//</span><span style="color: #008000;"> Constructor calls base class constructor:</span> <span style="color: #0000ff;">function</span><span style="color: #000000;"> MyScripts(guiAction) { EAction.call(</span><span style="color: #0000ff;">this</span><span style="color: #000000;">, guiAction); } </span><span style="color: #008000;">//</span><span style="color: #008000;"> Derive class MyScripts from class EAction:</span> MyScripts.prototype = <span style="color: #0000ff;">new</span><span style="color: #000000;"> EAction(); </span><span style="color: #008000;">//</span><span style="color: #008000;"> This static function returns a new or existing QMenu object.</span> MyScripts.getMenu = <span style="color: #0000ff;">function</span><span style="color: #000000;">() { </span><span style="color: #008000;">//</span><span style="color: #008000;"> EAction.getMenu is a helper function that returns an existing </span> <span style="color: #008000;">//</span><span style="color: #008000;"> or new QMenu object with the given title and object name.</span> <span style="color: #008000;">//</span><span style="color: #008000;"> The object name (here "MyScriptMenu") must be unique. </span> <span style="color: #0000ff;">return</span> EAction.getMenu(MyScripts.getTitle(), "MyScriptsMenu"<span style="color: #000000;">); }; </span><span style="color: #008000;">//</span><span style="color: #008000;"> This static function returns a new or existing QToolBar object.</span> MyScripts.getToolBar = <span style="color: #0000ff;">function</span><span style="color: #000000;">() { </span><span style="color: #008000;">//</span><span style="color: #008000;"> EAction.getToolBar is a helper function that returns an existing </span> <span style="color: #008000;">//</span><span style="color: #008000;"> or new QToolBar object with the given title and object name.</span> <span style="color: #008000;">//</span><span style="color: #008000;"> The object name (here "MyScriptToolBar") must be unique. </span> <span style="color: #0000ff;">return</span> EAction.getToolBar(MyScripts.getTitle(), "MyScriptToolBar"<span style="color: #000000;">); }; </span><span style="color: #008000;">//</span><span style="color: #008000;"> This static function defines and returns the title of the menu </span><span style="color: #008000;"> //</span><span style="color: #008000;"> and toolbar.</span><span style="color: #008000;"> //</span><span style="color: #008000;"> The qsTr function marks the title as a translatable string.</span> MyScripts.getTitle = <span style="color: #0000ff;">function</span><span style="color: #000000;">() { </span><span style="color: #0000ff;">return</span> qsTr("My Scripts"<span style="color: #000000;">); }; </span><span style="color: #008000;">//</span><span style="color: #008000;"> Init creates the menu and toolbar on start.</span> MyScripts.init = <span style="color: #0000ff;">function</span><span style="color: #000000;">() { MyScripts.getMenu(); MyScripts.getToolBar(); };</span></pre> </div> <p> </p> <p>如下脚本代码复制到MyAction.js文g中:(x)</p> <div id="fx9rnft" class="cnblogs_code"> <pre><span style="color: #008000;">/*</span><span style="color: #008000;">* * Copyright (c) 2011-2018 by Andrew Mustun. All rights reserved. * * This file is part of the QCAD project. * * QCAD is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * QCAD is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with QCAD. </span><span style="color: #008000;">*/</span> <span style="color: #008000;">//</span><span style="color: #008000;"> MyAction.js</span><span style="color: #008000;"> //</span><span style="color: #008000;"> Include base class definition:</span> include("../MyScripts.js"<span style="color: #000000;">); </span><span style="color: #008000;">//</span><span style="color: #008000;"> Constructor calls base class constructor:</span> <span style="color: #0000ff;">function</span><span style="color: #000000;"> MyAction(guiAction) { MyScripts.call(</span><span style="color: #0000ff;">this</span><span style="color: #000000;">, guiAction); } </span><span style="color: #008000;">//</span><span style="color: #008000;"> Derive class MyAction from class MyScripts:</span> MyAction.prototype = <span style="color: #0000ff;">new</span><span style="color: #000000;"> MyScripts(); </span><span style="color: #008000;">//</span><span style="color: #008000;"> This function is called immediately after the constructor when the user </span><span style="color: #008000;"> //</span><span style="color: #008000;"> starts this action. For actions that don't require any user input (for</span><span style="color: #008000;"> //</span><span style="color: #008000;"> example auto zoom), beginEvent does everything and then terminates the</span><span style="color: #008000;"> //</span><span style="color: #008000;"> action.</span> MyAction.prototype.beginEvent = <span style="color: #0000ff;">function</span><span style="color: #000000;">() { </span><span style="color: #008000;">//</span><span style="color: #008000;"> call base class implementation of beginEvent:</span> MyScripts.prototype.beginEvent.call(<span style="color: #0000ff;">this</span><span style="color: #000000;">); </span><span style="color: #008000;">//</span><span style="color: #008000;"> get main application window:</span> <span style="color: #0000ff;">var</span> appWin =<span style="color: #000000;"> EAction.getMainWindow(); </span><span style="color: #008000;">//</span><span style="color: #008000;"> print a message in the console of QCAD:</span> appWin.handleUserMessage("MyAction() is running..."<span style="color: #000000;">); </span><span style="color: #008000;">//</span><span style="color: #008000;"> terminate this action immediately:</span> <span style="color: #0000ff;">this</span><span style="color: #000000;">.terminate(); }; </span><span style="color: #008000;">//</span><span style="color: #008000;"> MyAction.init() is called by QCAD to initialize the action and create</span><span style="color: #008000;"> //</span><span style="color: #008000;"> the menu / toolbar for it.</span> MyAction.init = <span style="color: #0000ff;">function</span><span style="color: #000000;">(basePath) { </span><span style="color: #008000;">//</span><span style="color: #008000;"> Create a new RGuiAction (extended QAction):</span> <span style="color: #0000ff;">var</span> action = <span style="color: #0000ff;">new</span> RGuiAction("&My Action"<span style="color: #000000;">, RMainWindowQt.getMainWindow()); </span><span style="color: #008000;">//</span><span style="color: #008000;"> This action requires a document to be open. If no document is</span> <span style="color: #008000;">//</span><span style="color: #008000;"> open, the menu and tool button are grayed out:</span> action.setRequiresDocument(<span style="color: #0000ff;">true</span><span style="color: #000000;">); </span><span style="color: #008000;">//</span><span style="color: #008000;"> Define the script file that is executed when this action is</span> <span style="color: #008000;">//</span><span style="color: #008000;"> launched:</span> action.setScriptFile(basePath + "/MyAction.js"<span style="color: #000000;">); </span><span style="color: #008000;">//</span><span style="color: #008000;"> Set the icon that is shown in the toolbar and on some platforms</span> <span style="color: #008000;">//</span><span style="color: #008000;"> also in the menu:</span> action.setIcon(basePath + "/MyAction.svg"<span style="color: #000000;">); </span><span style="color: #008000;">//</span><span style="color: #008000;"> Set the command(s) that can be used on the command line to </span> <span style="color: #008000;">//</span><span style="color: #008000;"> launch this action:</span> action.setDefaultCommands(["myaction"<span style="color: #000000;">]); </span><span style="color: #008000;">//</span><span style="color: #008000;"> Define the sort order of this action. Menus and tool buttons are</span> <span style="color: #008000;">//</span><span style="color: #008000;"> ordered by these values:</span> action.setGroupSortOrder(80100<span style="color: #000000;">); action.setSortOrder(</span>200<span style="color: #000000;">); </span><span style="color: #008000;">//</span><span style="color: #008000;"> Set list of widgets this action is added to</span> <span style="color: #008000;">//</span><span style="color: #008000;"> (menus, tool bars, CAD tool bar panels):</span> action.setWidgetNames(["MyScriptsMenu"<span style="color: #000000;">]); };</span></pre> </div> <p> </p> <p>启动QCAD可以发现在菜单上有了(jin)MyScriptsQ如下图所C:(x)</p> <p><a ><img style="background-image: none; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border: 0px;" title="wps_clip_image-31967" src="https://images2018.cnblogs.com/blog/534255/201806/534255-20180621232153012-1158677768.png" alt="wps_clip_image-31967" width="576" height="310" border="0" /></a></p> <p>点击MyAction菜单Q会(x)在命令窗口中输出试文字?/p> <h2>3.C++</h2> <p>既然QCAD的是ZQt开发的Q理所当然地应该支持C++开发,只是C++开发方式需要与JavaScript相结合。因为QCAD中一些交互功能封装到JavaScript脚本中了(jin)Q所以只能通过在JavaScript中调用C++。这U方式QCAD也提供了(jin)一个例子,位于源码?/p> <p>support\examples\exampleplugin中。主要是C++的类暴露lJavaScriptQ在JavaScript中可以调用C++的类?qing)其?gu)。只头文g源码列出如下QRExamplePlugin.h</p> <div id="jlrnhjn" class="cnblogs_code"> <pre>#include <QDebug><span style="color: #000000;"> #include </span><QObject><span style="color: #000000;"> #include </span><QScriptEngine><span style="color: #000000;"> #include </span><QStringList><span style="color: #000000;"> #include </span><span style="color: #800000;">"</span><span style="color: #800000;">RActionAdapter.h</span><span style="color: #800000;">"</span><span style="color: #000000;"> #include </span><span style="color: #800000;">"</span><span style="color: #800000;">RDocumentInterface.h</span><span style="color: #800000;">"</span><span style="color: #000000;"> #include </span><span style="color: #800000;">"</span><span style="color: #800000;">RGuiAction.h</span><span style="color: #800000;">"</span><span style="color: #000000;"> #include </span><span style="color: #800000;">"</span><span style="color: #800000;">RMainWindow.h</span><span style="color: #800000;">"</span><span style="color: #000000;"> #include </span><span style="color: #800000;">"</span><span style="color: #800000;">RPluginInterface.h</span><span style="color: #800000;">"</span> <span style="color: #0000ff;">class</span> MyAction : <span style="color: #0000ff;">public</span><span style="color: #000000;"> RActionAdapter { </span><span style="color: #0000ff;">public</span><span style="color: #000000;">: MyAction(RGuiAction</span>*<span style="color: #000000;"> guiAction) : RActionAdapter(guiAction) {} </span><span style="color: #0000ff;">static</span> <span style="color: #0000ff;">void</span> factory(RGuiAction*<span style="color: #000000;"> guiAction) { qDebug() </span><< <span style="color: #800000;">"</span><span style="color: #800000;">MyAction::factory</span><span style="color: #800000;">"</span><span style="color: #000000;">; </span><span style="color: #0000ff;">if</span> (guiAction==<span style="color: #000000;">NULL) { qDebug(</span><span style="color: #800000;">"</span><span style="color: #800000;">guiAction is NULL</span><span style="color: #800000;">"</span><span style="color: #000000;">); </span><span style="color: #0000ff;">return</span><span style="color: #000000;">; } RDocumentInterface</span>* di =<span style="color: #000000;"> RMainWindow::getDocumentInterfaceStatic(); </span><span style="color: #0000ff;">if</span> (di==<span style="color: #000000;">NULL) { qDebug(</span><span style="color: #800000;">"</span><span style="color: #800000;">di is NULL</span><span style="color: #800000;">"</span><span style="color: #000000;">); </span><span style="color: #0000ff;">return</span><span style="color: #000000;">; } di</span>->setCurrentAction(<span style="color: #0000ff;">new</span><span style="color: #000000;"> MyAction(guiAction)); } </span><span style="color: #0000ff;">virtual</span> <span style="color: #0000ff;">void</span><span style="color: #000000;"> beginEvent() { qDebug() </span><< <span style="color: #800000;">"</span><span style="color: #800000;">MyAction::beginEvent</span><span style="color: #800000;">"</span><span style="color: #000000;">; } }; </span><span style="color: #0000ff;">class</span> MyClass : <span style="color: #0000ff;">public</span><span style="color: #000000;"> QObject { Q_OBJECT </span><span style="color: #0000ff;">public</span><span style="color: #000000;">: MyClass() : QObject(), i(</span><span style="color: #800080;">0</span>), d(<span style="color: #800080;">0.0</span><span style="color: #000000;">) {} </span><span style="color: #0000ff;">virtual</span> <span style="color: #0000ff;">int</span> getInt() <span style="color: #0000ff;">const</span><span style="color: #000000;"> { </span><span style="color: #0000ff;">return</span><span style="color: #000000;"> i; } </span><span style="color: #0000ff;">virtual</span> <span style="color: #0000ff;">double</span> getDouble() <span style="color: #0000ff;">const</span><span style="color: #000000;"> { </span><span style="color: #0000ff;">return</span><span style="color: #000000;"> d; } </span><span style="color: #0000ff;">virtual</span> QString getString() <span style="color: #0000ff;">const</span><span style="color: #000000;"> { </span><span style="color: #0000ff;">return</span><span style="color: #000000;"> s; } </span><span style="color: #0000ff;">virtual</span> <span style="color: #0000ff;">void</span> setInt(<span style="color: #0000ff;">int</span><span style="color: #000000;"> v) { i </span>=<span style="color: #000000;"> v; } </span><span style="color: #0000ff;">virtual</span> <span style="color: #0000ff;">void</span> setDouble(<span style="color: #0000ff;">int</span><span style="color: #000000;"> v) { d </span>=<span style="color: #000000;"> v; } </span><span style="color: #0000ff;">virtual</span> <span style="color: #0000ff;">void</span> setString(<span style="color: #0000ff;">const</span> QString&<span style="color: #000000;"> v) { s </span>=<span style="color: #000000;"> v; } </span><span style="color: #0000ff;">void</span><span style="color: #000000;"> emitSignal() { emit mySignal(i); } signals: </span><span style="color: #0000ff;">void</span> mySignal(<span style="color: #0000ff;">int</span><span style="color: #000000;"> code); </span><span style="color: #0000ff;">private</span><span style="color: #000000;">: </span><span style="color: #0000ff;">int</span><span style="color: #000000;"> i; </span><span style="color: #0000ff;">double</span><span style="color: #000000;"> d; QString s; }; Q_DECLARE_METATYPE(MyClass</span>*<span style="color: #000000;">) </span><span style="color: #008000;">/*</span><span style="color: #008000;">* * Script binding for MyClass. </span><span style="color: #008000;">*/</span> <span style="color: #0000ff;">class</span><span style="color: #000000;"> EcmaMyClass { </span><span style="color: #0000ff;">public</span><span style="color: #000000;">: </span><span style="color: #0000ff;">static</span> <span style="color: #0000ff;">void</span> initEcma(QScriptEngine&<span style="color: #000000;"> engine); </span><span style="color: #0000ff;">static</span> QScriptValue createMyClass(QScriptContext* context, QScriptEngine*<span style="color: #000000;"> engine); </span><span style="color: #0000ff;">static</span> QScriptValue myClassToString(QScriptContext *context, QScriptEngine *<span style="color: #000000;">engine); </span><span style="color: #0000ff;">static</span> MyClass* getSelfMyClass(<span style="color: #0000ff;">const</span> QString& fName, QScriptContext*<span style="color: #000000;"> context); </span><span style="color: #0000ff;">static</span> QScriptValue getInt(QScriptContext* context, QScriptEngine*<span style="color: #000000;"> engine); </span><span style="color: #0000ff;">static</span> QScriptValue getDouble(QScriptContext* context, QScriptEngine*<span style="color: #000000;"> engine); </span><span style="color: #0000ff;">static</span> QScriptValue getString(QScriptContext* context, QScriptEngine*<span style="color: #000000;"> engine); </span><span style="color: #0000ff;">static</span> QScriptValue setInt(QScriptContext* context, QScriptEngine*<span style="color: #000000;"> engine); </span><span style="color: #0000ff;">static</span> QScriptValue setDouble(QScriptContext* context, QScriptEngine*<span style="color: #000000;"> engine); </span><span style="color: #0000ff;">static</span> QScriptValue setString(QScriptContext* context, QScriptEngine*<span style="color: #000000;"> engine); </span><span style="color: #0000ff;">static</span> QScriptValue emitSignal(QScriptContext* context, QScriptEngine*<span style="color: #000000;"> engine); }; </span><span style="color: #0000ff;">class</span> RExamplePlugin : <span style="color: #0000ff;">public</span> QObject, <span style="color: #0000ff;">public</span><span style="color: #000000;"> RPluginInterface { Q_OBJECT Q_INTERFACES(RPluginInterface) </span><span style="color: #0000ff;">#if</span> QT_VERSION >= 0x050000<span style="color: #000000;"> Q_PLUGIN_METADATA(IID </span><span style="color: #800000;">"</span><span style="color: #800000;">org.qcad.exampleplugin</span><span style="color: #800000;">"</span><span style="color: #000000;">) </span><span style="color: #0000ff;">#endif</span> <span style="color: #0000ff;">public</span><span style="color: #000000;">: </span><span style="color: #0000ff;">virtual</span> <span style="color: #0000ff;">bool</span><span style="color: #000000;"> init(); </span><span style="color: #0000ff;">virtual</span> <span style="color: #0000ff;">void</span> uninit(<span style="color: #0000ff;">bool</span><span style="color: #000000;">) {} </span><span style="color: #0000ff;">virtual</span> <span style="color: #0000ff;">void</span><span style="color: #000000;"> postInit(InitStatus status); </span><span style="color: #0000ff;">virtual</span> <span style="color: #0000ff;">void</span> initScriptExtensions(QScriptEngine&<span style="color: #000000;"> engine); </span><span style="color: #0000ff;">virtual</span><span style="color: #000000;"> RPluginInfo getPluginInfo(); };</span></pre> </div> <p> </p> <p>从上q源码可以看出,通过Qt的Plguin机制C++的类暴露lJavaScriptQ从而在JavaScript中用C++的功能。如下图所CZؓ(f)在QCAD中通过JavaScript调用C++来显CZ个三l视囄H口?/p> <p><a ><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="wps_clip_image-25228" src="https://images2018.cnblogs.com/blog/534255/201806/534255-20180621232154829-361057710.png" alt="wps_clip_image-25228" width="577" height="455" border="0" /></a></p> <h2>4.Conclusion</h2> <p>lg所qͼQCAD二次开发的方式主要是以JavaScriptZ。如果要在QCAD中用C++Q或者是使用C++的第三方库,只能是将相关的C++cL露给JavaScirptQ这样开发才是最单的。如果纯用C++开发,一些交互功能是装在JavaScript中,反而效率不高?/p> <p>通过在QCAD中用OpenCASCADE之类的三l几何内核,可以实现一些徏模、出囄功能?/p> <h2>5.References</h2> <p>1. <a >https://www.qcad.org/doc/qcad/latest/developer/_menus_and_tool_bars.html</a></p> <p>2. <a >https://www.qcad.org/doc/qcad/latest/developer/index.html#what_is</a></p> <p>3. <a >https://www.qcad.org/rsforum/viewforum.php?f=30&sid=8621b8249232845e54252ef7fa6b34ae</a></p> <p>4. JavaScript 高E序设计</p> <p>5. C++ GUI Programming with Qt<br /><br /></p><div class="1d9t7zz" id="cnblogs_post_body" class="blogpost-body" style="margin: 0px 0px 20px; word-break: break-word; font-family: "Helvetica Neue", Helvetica, Verdana, Arial, sans-serif; background-color: #ffffff;"><div class="79nvppb" id="MySignature" style="margin: 0px;"><hr style="margin: 0px; padding: 0px;" /><h5>Z(jin)方便大家在移动端也能看到我的博文和讨Z,现已注册微信公众PƢ迎大家扫描下方二维码关注?/h5><img title="OpenCASCADE公众P(x)开?分n-乐趣QOPEN-SHARE-FUN" border="0" alt="Shing Liu(eryar@163.com)" src="https://files.cnblogs.com/files/opencascade/qrcode_occ.gif" width="200" height="200" style="margin: 0px; padding: 0px; border: 0px; background-image: none; display: inline;" /><hr style="margin: 0px; padding: 0px;" /></div><div style="margin: 0px; clear: both;"></div><div class="bj777ll" id="blog_post_info_block" style="margin: 20px 0px 0px;"><div class="vrjbvnp" id="BlogPostCategory" style="margin: 0px 0px 10px; color: #666666;"></div></div></div><p> </p><img src ="http://www.shnenglu.com/eryar/aggbug/215735.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/eryar/" target="_blank">eryar</a> 2018-06-21 23:28 <a href="http://www.shnenglu.com/eryar/archive/2018/06/21/QCAD_Plugin.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>~译QCADhttp://www.shnenglu.com/eryar/archive/2018/06/03/qcad.htmleryareryarSun, 03 Jun 2018 12:53:00 GMThttp://www.shnenglu.com/eryar/archive/2018/06/03/qcad.htmlhttp://www.shnenglu.com/eryar/comments/215698.htmlhttp://www.shnenglu.com/eryar/archive/2018/06/03/qcad.html#Feedback0http://www.shnenglu.com/eryar/comments/commentRss/215698.htmlhttp://www.shnenglu.com/eryar/services/trackbacks/215698.html~译QCAD

eryar@163.com

目前开源的二维CAD有QCAD、LibreCAD{,且LibreCAD可以说是QCAD的分支版本。对比这Ƒּ源YӞ发现QCAD的功能与操作?fn)惯和AutoCAD更接q。LibreCAD是纯C++开发,而QCAD使用?jin)Qt的Script模块Q用了(jin)C++和Javascript脚本两种开发方式。我觉得使用脚本来扩展功能比UC++开发效率会(x)高点Q因些开源项目源码都很大Q编译比较花旉。如果用脚本来开发的话,没有~译旉Q可以边写脚本边试Q很方便?/p>

下面两个分别是LibreCAD和QCAD中显C图形属性的界面Q可以看到QCAD感觉更好?/p>

wps_clip_image-25075

Figure 1. LibreCAD Main GUI

wps_clip_image-10281

Figure 2. QCAD Main GUI

QCAD的编译很单,?https://github.com/qcad/qcad 下蝲源码后,可以直接编译了(jin)。其依赖的相关第三方库都已经包含在源码中。下面就以在Windows操作pȝ中用VS2008来编译QCAD-3.20.1.2Z来说明其~译需要注意的问题。考虑到Qt4相关的dll文g较少Q所以选择Qt4.8.6和Visual Studio2008来编译QCAD?/p>

在VS中用Qt可以使用QtVSAddinQ安装好QtVSAddin后会(x)在VS的菜单上出现一个Qt菜单Q?/p>

wps_clip_image-3384

Figure 3. QtVSAddin Menu in VS2008

从Qt插g的菜单中的Open Qt Project File来打开qcad源码文g中的qcad.proQ会(x)生成qcad.sln的VS解决Ҏ(gu)文gQƈ在VS2008打开?jin)解x(chng)案?/p>

wps_clip_image-7778

Figure 4. QCad source code in VS2008

~译到RScriptHandlerEcma.cpp文gӞ遇到几个QPrinterInfo?rn)态函数的问题Q因为qcad-3.20.1.2中推荐用Qt5.5.1Q而这几个?rn)态函数是从Qt5.3版本才引入的。所以找到Qt5.3中相关的源码Q把关于QPrinterInfo的几个静(rn)态函数在q里重写。从字面上看q几个函数是与打印相关的Q如果不使用打印相关功能Q可以直接把q几个错误注释掉?/p>

因ؓ(f)qcad与界面相关的功能都是用JavaScript脚本实现Q所以还需要编译Qt的脚本实现。找到源码的src目录中的3rdparty文g夹中与Qt版本对应的qt-labs-qtscriptgeneratorQ里面会(x)已经生成?jin)VS的解x(chng)案。直接用VS打开解决Ҏ(gu)Q全部编译即可?/p>

wps_clip_image-13200

wps_clip_image-15602

wps_clip_image-7482

 Figure 5.~译qt script

~译成功后,文g都会(x)生成在指定的目录中,直接打开源码下面的debug文g中的qcad.exe卛_以运行QCAD?jin)?/p>

wps_clip_image-16781

Figure 6. q行~译的QCAD

 



Z(jin)方便大家在移动端也能看到我的博文和讨Z,现已注册微信公众PƢ迎大家扫描下方二维码关注?/h5>Shing Liu(eryar@163.com)


eryar 2018-06-03 20:53 发表评论
]]>
dimradius by AutoLisp in AutoCADhttp://www.shnenglu.com/eryar/archive/2017/05/18/214947.htmleryareryarThu, 18 May 2017 13:33:00 GMThttp://www.shnenglu.com/eryar/archive/2017/05/18/214947.htmlhttp://www.shnenglu.com/eryar/comments/214947.htmlhttp://www.shnenglu.com/eryar/archive/2017/05/18/214947.html#Feedback0http://www.shnenglu.com/eryar/comments/commentRss/214947.htmlhttp://www.shnenglu.com/eryar/services/trackbacks/214947.htmldimradius by AutoLisp in AutoCAD

eryar@163.com

最q在开发一个自动出囄序,从PDMS模型中取数据后,l过处理生成AutoCAD的图U。其中涉?qing)到一个问题就是如何尽量ɽE序与AutoCAD低耦合Q尽量不使用W三方库的情况下Q实现数据的传递?

最开始想到是用ODA(Open Design Alliance)的DWGdirect库来直接生成DWG文gQƈ且PDMS中就是用这个库来生成DWG文g的。DWGdirect的用法与AutoCAD .Net的接口名U基本一_(d)用法也相同,但是q样引入了(jin)W三方库?

q有一U方法就是用AutoLisp脚本来生成图U。这L(fng)话,E序只需要生成一个AutoLisp脚本文gQ文件中包含创徏囑Ş的命令。AutoLisp脚本与PDMS的PMLcMQ都需要一个解析执行的环境Q即PML依赖PDMSq_才能q行QAutoLisp依赖AutoCADq_。如果用AutoLispQ程序不依赖DWG相关的第三方库,只需要生成一个文本文件。决定用AutoLisp后,q有一个问题,是如何在启动AutoCAD能自动加载生成的AutoLisp文gȝ成图U?

从网上查到自动加载程序的Ҏ(gu)QAbout Auto-Loading and Running AutoLISP RoutinesQ?

http://help.autodesk.com/view/ACD/2015/ENU/?guid=GUID-FDB4038D-1620-4A56-8824-D37729D42520 Q发C用acaddoc.lsp的方法最方便。方法如下:(x)

1. 使用一个模板DWG文gTemplate.dwgQ?

2. 在模板DWG文gTemplate.dwg相同的目录中Q放一个acaddoc.lsp脚本文gQ其中内容可以参考如下方式:(x)

wps7FEA.tmp

3. E序生成一个脚本文件myapp.lsp到acaddoc.lsp的文件夹中,然后再打开模板DWG文gTemplate.dwg?

l过上述处理Q程序在打开模板DWG文g的时候会(x)启动AutoCADQ启动AutoCAD的时候会(x)加蝲acaddoc.lsp文gQ在acaddoc.lsp中又?x)加载myapp.lspQ这样就?x)执行myapp.lsp中的命o(h)Q自动生成图U怺(jin)?

囑Ş的生成可以用AutoCAD中的命o(h)Q如生成直线可以使用lineQ生成圆可以使用circleQ等{。对生成的图形进行标注的时候,发现U性标注很方便使用命o(h)自动生成Q但是想标注半径或直径的时候,一直没有测试成功。后来测试成功后Q将q些命o(h)C来,方便查询?

;; create a circle at (0,0,0) and radius is 8
(setq aCenter (list 0 0 0))
(setq aRadius 8)
(command "circle" aCenter aRadius "")
;; remember the circle and dimradius
(setq aCircle (entlast))
(setq aPoint (polar aCenter 45 aRadius))
(setq aDim (cons aCircle (list aPoint)))
(command "dimradius" aDim aPoint)
;; zoom all
(command "zoom" "e")

打开Template.dwg的时候,?x)自动生成如下内容?x)

wps7FFB.tmp

使用AutoLisp脚本文g来作为数据交换的方式来开发程序,可以使自qE序不依赖DWGd相关的第三方库,使程序更E_?

使用AutoLisp来自动生成标注的时候,U性标注很Ҏ(gu)生成Q只需要指定几个点卛_。可是生成半径或直径标注数据Ӟ因ؓ(f)需要选择圆弧QAutoLisp不是那么直观?



eryar 2017-05-18 21:33 发表评论
]]>
OpenSceneGraph in ActiveX by ActiveQthttp://www.shnenglu.com/eryar/archive/2016/11/11/214404.htmleryareryarFri, 11 Nov 2016 15:32:00 GMThttp://www.shnenglu.com/eryar/archive/2016/11/11/214404.htmlhttp://www.shnenglu.com/eryar/comments/214404.htmlhttp://www.shnenglu.com/eryar/archive/2016/11/11/214404.html#Feedback0http://www.shnenglu.com/eryar/comments/commentRss/214404.htmlhttp://www.shnenglu.com/eryar/services/trackbacks/214404.htmlOpenSceneGraph in ActiveX by ActiveQt

eryar@163.com

Abstract. Qt’s ActiveX and COM support allows Qt for Windows developers to access and use ActiveX controls and COM objects provided by any ActiveX server in their Qt applications. Make their Qt application available as COM servers, with any number of Qt objects and widgets as COM objects and ActiveX controls. Make OpenSceneGraph to ActiveX controls then you can use it in other place, like IE.

Key Words. OpenSceneGraph, ActiveX, COM, ActiveQt

1.Introduction

ActiveX是一个开攄集成q_Qؓ(f)开发h员、用户和W(xu)eb生商提供了(jin)一个快速而简便的在Internet 和Intranet创徏E序集成和内容的Ҏ(gu)。用AcitveX可以L方便地在Web面中插入多媒体效果、交互式对象?qing)复杂程序。编写的ActiveX控g可以在不同的E序上运行,如Internet Explorer, Visual Basic, MFC- and ATL-based containters{等?

本文试使用Qt的ActiveQt模块OpenSceneGraph装成ActiveX控gQƈ在Internet Explorer中显C出三维模型?

2.ActiveQt

?fn)惯了(jin)用Qt装的对象,用着舒服。Qt的Windows商业版本和开源版本都提供?jin)ActiveQt框架Q用这个组件我们可以在Qt中用ActiveX控gQƈ且也可以开发基于Qt的ActiveX控g。ActiveQt包含?jin)两个组件QAxContainter和QAxServerQ?

v QAxContainer允许我们使用COM对象Q像使用Excel的COM对象Q就可以对Excelq行d?jin)?

v QAxServer可以我们写的Qt控g导出为COM对象或者ActiveX控g?

使用ActiveQt来编写ActiveX控gq是要简单很多的?

3.OpenSceneGraph

OpenSceneGraph是对OpenGL面向对象的封装,使用OpenSceneGraph可以方便地对三维场景q行处理Q可以用于三l可视化Q仿真等领域。因Z是纯C++开发,所以生了(jin)OpenSceneGraph~写成ActiveX控g的想法,q样可以在Web上来操作三维场景?jin)?

4.Example

首先在Visual Studio中创Z个ActiveQt Server目Q如下图所C:(x)

wpsDE63.tmp

接下来用osgQt模块来在Qt中用OpenSceneGraphQ只需要增加一个初始化函数Q代码如下所C:(x)

void osgActiveX::init()
{
    osgQt::initQtWindowingSystem();

    myRootNode = new osg::PositionAttitudeTransform();

    myRootNode->addChild(osgDB::readNodeFile("d:/test.stl"));

    myViewer = new osgViewer::Viewer();
    myViewer->addEventHandler(new osgGA::StateSetManipulator(myViewer->getCamera()->getOrCreateStateSet()));
    myViewer->addEventHandler(new osgViewer::StatsHandler());
    myViewer->setCameraManipulator(new osgGA::TrackballManipulator());
    myViewer->setSceneData(myRootNode);

    osgQt::setViewer(myViewer);

    myOsgWidget = new osgQt::GLWidget(this);
    myGraphicsContext = new osgQt::GraphicsWindowQt(myOsgWidget);

    myViewer->getCamera()->setViewport(0, 0, myOsgWidget->width(), myOsgWidget->height());
    myViewer->getCamera()->setProjectionMatrixAsPerspective( 30.0f, static_cast<double>(myOsgWidget->width())/static_cast<double>(myOsgWidget->height()), 1.0f, 10000.0f );
    myViewer->getCamera()->setGraphicsContext(myGraphicsContext);

    setCentralWidget(myOsgWidget);
}

~译生成一个ActiveX控g后,再写一个HTML文g来测试生成的l果Q其中HTML文g中的主要内容如下Q?

<object ID="OsgActiveX" CLASSID="CLSID:450B2B35-9AC6-4FCD-A883-2ACF0FA19A16">
    [Object not available! Did you forget to build and register the server?]
</object>

其中CLASSID是用QAXFACTORY_DEFAULT宏定义注册时的GUID。程序运行结果如下图所C:(x)

wpsDE64.tmp

5.Conclusion

使用ActiveQtOpenSceneGraph装成ActiveX控gQ这L(fng)控g可以在多个E序中用,如IEQVisual Basic{等?

{熟l理解ActiveQt后,可以对OSG的ActiveX控gq行扩展Q其有更强大的三维交互功能?

6.References

1. Qt’s ActiveX Framework

2. https://zh.wikipedia.org/wiki/ActiveX

 



eryar 2016-11-11 23:32 发表评论
]]>
Windows7 Debug Testhttp://www.shnenglu.com/eryar/archive/2016/04/09/213223.htmleryareryarSat, 09 Apr 2016 09:44:00 GMThttp://www.shnenglu.com/eryar/archive/2016/04/09/213223.htmlhttp://www.shnenglu.com/eryar/comments/213223.htmlhttp://www.shnenglu.com/eryar/archive/2016/04/09/213223.html#Feedback0http://www.shnenglu.com/eryar/comments/commentRss/213223.htmlhttp://www.shnenglu.com/eryar/services/trackbacks/213223.htmlWindows7 Debug Test

eryar@163.com

1.Introduction

在郁大师的媄(jing)响下Q很早之前买?jin)本王爽老师的《汇~语a》,可惜一直闲|,今天l于得空Q可以学?fn)v来了(jin)。ؓ(f)?jin)学?fn)效果更好Q还是写点东西记录下来,一斚w巩固下知识点Q一斚w起到一个监督作用?

毕竟不是计算Z业科班出w,q些计算机基知识只有靠自学。意识到汇编的重要性是从大师可以反汇编和逆向一些Y件开始的。汇~在Debug的过E中也有重要作用Q如在Debug时看到这U界面,L有想理解其意义的好奇?j)?x)

wps_clip_image-15646

Figure 1. Disassembly and Registers in Visual Studio

通过反汇~代码,对程序的q行情况更加清晰。学?fn)汇~的两个目的Q充分获得底层编E的体验Q深ȝ解机器运行程序的机理。知道了(jin)来胧去脉Q在应用的过E中才能更加自信?

本文主要介绍在Windows7中运行debugQƈ在debugE序中执行汇~代码,从而方便理论知识的学习(fn)?

2.Run Debug in Windows7 

Debug是DOS, Windows提供的实模式(8086)E序的调试工P使用它可以查看CPU各种寄存器、内存情况和在机器码U跟t程序的q行。因为debugE序?6位的Q在64位的Windows7中无法运行,所以根据网上的Ҏ(gu)Q先安装一个DOS模拟环境Q再q行debug?

分别下蝲工具DOS BOX?2位机器上的debugQ这里给出DOSBOX和MASMQ其中Debug包含在MASM中?

wps_clip_image-27561

Figure 2. DOSBox for Debug

安装好DOSBox后,MASM攑ֈD盘(sh)Q运行如下命令来q行DebugQ?

mount c d:\MASM 

c: 

debug 

-

可以显CCPU中的相关信息Q如下图所C:(x)

wps_clip_image-32082

Figure 3. Debug in DOSBox

Debug的命令比较多Q下面简单介l几个常用的Q?

v R命o(h)Q查看、修改CPU寄存器的内容Q?

v D命o(h)Q查看内存(sh)的内容;

v A命o(h)Q以汇编指o(h)的格式在内存?sh)写入一条机器指令;

v T命o(h)Q执行一条机器指令;

2.1 R命o(h)

CPU的寄存器有AXQBXQCXQDXQCSQIP{,通过R命o(h)Q可以查看这些寄存器中的信息。若要修改一个寄存器的|比如AX中的|可用R命o(h)后加寄存器名来进行,输入r ax后回车,在:(x)提示后输入一个数值即可?

wps_clip_image-15649

Figure 4. Modify AX by R command

可以采用同样的方式来修改其他寄存器中的内容,如IPQCS{?

2.2 D命o(h)

Debug的D命o(h)可以查看内存?sh)的内容Q直接输入D命o(h)后,?x)给出默认内存地址的信息,如下图所C:(x)

wps_clip_image-5542

Figure 5. D command

也可以用“d D地址:偏移地址”来列出指定内存单元中的信息,如下图所C:(x)

wps_clip_image-17178

Figure 6. D command 

2.3 A命o(h)

Debug的A命o(h)以汇~指令Ş式在内存?sh)写入机器指令。这样就可以方便试汇编代码的效果。如下图所C向1000:0中写入汇~指令:(x)

wps_clip_image-20324

Figure 7. Write Assembly Code by A Command

如上图所C,在A命o(h)后跟上地址Q然后就可以向相应地址中写入汇~指令。再用D命o(h)查看内存Ӟ可以看到相应的机器码。有?jin)汇~代码,如何q行呢?需要用到T命o(h)?

2.4 T命o(h)

T命o(h)用于执行CS:IP指向的内存单元处的指令。所以要执行A命o(h)写的汇编指o(h)Q需要先通过R命o(h)修改CS和IP寄存器的内容Q他们指向A命o(h)汇编指o(h)所在的内存地址。如上图所C的A命o(h)是将汇编指o(h)写到1000:0处,所以修改CS和IP使他们指向这个地址Q?

wps_clip_image-32639

Figure 8. Modify CS & IP by R command

上图所CZؓ(f)修改CS和IP后,通过R命o(h)昄出结果。修改CS和IP后,可以运行T命o(h)来执行我们写入的指o(h)?jin)?

wps_clip_image-30584

Figure 8. Run T command

q行一ơT命o(h)后,执行了(jin)一条汇~指令,q里执行?jin)mov ax,1Q执行后CS:IP指向?jin)下条指令的地址Q这样再执行一ơT命o(h)Q就执行?jin)mov bx,2Q如下图所C:(x)

wps_clip_image-8485

Figure 9. Run T Command

q行T命o(h)后,执行?jin)mov bx,2Q将BX中的内容改ؓ(f)2?jin)?

3.Conclusion

学习(fn)汇编语言Q对理解E序的运行机理有个清晰认识,是想从事计算机科学方面工作的必不可少的基?

通过安装DOSBox从而在Windows7中运行debug。ƈ通过debug的几个命令来熟?zhn)单的汇编指o(h)。最后通过AQR和T命o(h)Q在debug中运行汇~指令?

4.References

1. 王爽. 汇编语言. 清华大学出版C? 2013

Dowload DOSBox & MASM



eryar 2016-04-09 17:44 发表评论
]]>
Happy New Year 2016http://www.shnenglu.com/eryar/archive/2016/01/01/212585.htmleryareryarFri, 01 Jan 2016 11:38:00 GMThttp://www.shnenglu.com/eryar/archive/2016/01/01/212585.htmlhttp://www.shnenglu.com/eryar/comments/212585.htmlhttp://www.shnenglu.com/eryar/archive/2016/01/01/212585.html#Feedback7http://www.shnenglu.com/eryar/comments/commentRss/212585.htmlhttp://www.shnenglu.com/eryar/services/trackbacks/212585.html 

大学之前的时间都是按天来q的Q期盼着一天一天地快快长大Q期盼着q年I新衣,阖家团聚Q其乐融融;

大学的时间都是按周来q的Q根据每周的课表周而复始,虽然单调但也是自p在,单充实;

刚工作的几年旉是按月来q的Q每个月发工资的时候还是很开?j),虽然在大上v那微薄的薪水只能Ҏ(gu)在房U中Q但也是自食其力Q一个h战斗?/p>

现在的时间是按年来过的,一q又一q_(d)感慨一事无成的时候,一q眨g间已l过M(jin)?br /> 

在外打拼的时光虽然忙,但多有些漂泊感?012q腊月奶奶去世,没能回家看最后一面,很是遗憾?015q还很年ȝ大爹因脑溢血抢救无效?/p>

d?jin)。在感慨生命脆弱的同Ӟ也对工作、生zd?jin)一些思考。亲人需要陪_(d)有的错过是一辈子Q挣(zhun)再多的钱也于事无补。对于工作,虽然?/p>

是抱着强烈意愿来的Q但有没有学?fn)进步的氛围Q感觉在q种环境下学不到什么知识,所以做?jin)回家的军_。毕业后的几份工作经历,

有着很多隑ֿ的日子。刚毕业时的青ӆQ工作几q后的迷茫,到现在能扑ֈ前进的方向,一路走来要感谢的h很多。一直也很庆(jin)q自q好运气,?jin)幸没?/p>

被岁月变成自p厌的人?/p>

 

dq的工作是惬意的Q每天可以睡到自焉Q可以吃C人做的可口饭菜,不用担心(j)地沟油,不用挤公交地铁,q才是^淡生zȝ样子Q?/p>

生于忧?zhn)Q死于安乐,孟子的这句话也是很有道理的,所以一直以写blog的方式来使自己忙h。由于工作变动的原因Q需要适应新的环境Q今q发表的

blog相对一些,不过深度也大一些,收获也更大。感谢前辈们的鼓励和Q以?qing)h生经历的分n。感谢所有有梦想的友人,特别感谢Yang bin从大老远

带一桶a(b)送给我,q是很感动。只要坚持,梦想L?x)实现的Q希望在新的一q里Q大安能梦x(chng)真?/p>

 

2015q承接了(jin)几个项目,希望在新的一q中能合作共赢。lOPEN CASCADE的学?fn),希望能有更多的Aha!

富贵不能淫,贫贱不能U,威武不能屈,大家新q快乐,做自己喜Ƣ的自己。Happy New Year! To be what you want to be?/p>

macro3d



eryar 2016-01-01 19:38 发表评论
]]>
std::fstream 中文路径http://www.shnenglu.com/eryar/archive/2015/04/14/210335.htmleryareryarTue, 14 Apr 2015 11:47:00 GMThttp://www.shnenglu.com/eryar/archive/2015/04/14/210335.htmlhttp://www.shnenglu.com/eryar/comments/210335.htmlhttp://www.shnenglu.com/eryar/archive/2015/04/14/210335.html#Feedback0http://www.shnenglu.com/eryar/comments/commentRss/210335.htmlhttp://www.shnenglu.com/eryar/services/trackbacks/210335.htmlstd::fstream 中文路径

eryar@163.com

用C++来开发管道出囄序IsoAlgoӞ当P(yng)CF文g名中包含中文Ӟd文g?x)失败。将下面数据存成一个简单文Ӟ(x)中文.txt  攑ֈ目标目录中来试Q?

wps_clip_image-28291

Figure 1 包含中文的文?

单测试程序代码如下所C:(x)

#include <fstream>
#include 
<cassert>
#include 
<iostream>

int main(int argc, char* argv[])
{
    std::ifstream aFile(argv[
1]);

    assert(aFile.good());

    std::cout 
<< aFile.rdbuf() << std::endl;

    
return 0;
}

q在Visual Studio的命令参C传进L件名Q?

wps_clip_image-21877

Figure 2 Set Command Arguments

q行E序Q会(x)得到如下错误提示H口Q?

wps_clip_image-429

Figure 3 assert for the file

q是加上断言assert的效果,在Debug模式下可以很快定位到错误Q而在Release模式下就把这一行代码忽略了(jin)?

在网上搜?jin)下std::ifstreamd中文文g名的文g的解x(chng)案:(x)

v 使用C语言的函数设|成中文q行环境Q?

setlocale(LC_ALL,"Chinese-simplified");

v 使用STL中的函数讄为系l语a环境Q?

std::locale::global(std::locale(""));

因ؓ(f)IsoAlgo使用?jin)STL的C++Q所以选择Ҏ(gu)2。实C码如下所C:(x)

#include <fstream>
#include 
<cassert>
#include 
<iostream>

int main(int argc, char* argv[])
{
    std::locale::global(std::locale(
""));
    std::ifstream aFile(argv[
1]);
    std::locale::global(std::locale(
"C"));

    assert(aFile.good());

    std::cout 
<< aFile.rdbuf() << std::endl;

    
return 0;
}

E序q行l果如下图所C:(x)

wps_clip_image-11274



eryar 2015-04-14 19:47 发表评论
]]>
Create views of OpenCASCADE objects in the Debuggerhttp://www.shnenglu.com/eryar/archive/2015/01/31/209695.htmleryareryarSat, 31 Jan 2015 11:16:00 GMThttp://www.shnenglu.com/eryar/archive/2015/01/31/209695.htmlhttp://www.shnenglu.com/eryar/comments/209695.htmlhttp://www.shnenglu.com/eryar/archive/2015/01/31/209695.html#Feedback1http://www.shnenglu.com/eryar/comments/commentRss/209695.htmlhttp://www.shnenglu.com/eryar/services/trackbacks/209695.htmlCreate views of OpenCASCADE objects in the Debugger

eryar@163.com

Abstract. The Visual Studio Natvis framework lets you customize the way Visual Studio displays native types in debugger variable windows such as the Watch, Locals and Data Tips windows. It supersedes the autoexp.dat file that has been used in earlier versions of Visual Studio and offers XML syntax, better diagnostics, versioning, and multiple file support. The container in OpenCASCADE is difficult for debugging, such as TColStd_Array1OfInteger in the TColStd package, .etc. Use the natvis framework to create views of these objects will make it easy for developers to inspect them during debugging and so accelerate the debug process.

Key Words. Visual Studio Natvis, OpenCASCADE

1. Introduction

因ؓ(f)OpenCASCADE早期使用C开发,所以自定义?jin)一些容器类Q如包TColStd中的c,TColGeom包及(qing)包TopTools中的cȝQ这些类在C++中都可以使用STL来替代了(jin)。这些类在Debugq程中,很难查看其中的|如TColStd_Array1OfIntegerQ这个类相当于std::vector<int>Q但是Debug时只能看到数据的指针Q不Ҏ(gu)查看容器中每个元素的|如下?.1所C:(x)

wps_clip_image-3641

Figure 1.1 View of TColStd_Array1OfInteger in Locals Window

׃?.1可知Q对于这个类的对象,Debug时只能看到数据的起始指针。ؓ(f)?jin)方便自定义cd调试QVisual Studio?012版本以后Q引入了(jin)Natvis框架Q用来替代原来的autoexp.dat来ؓ(f)自定义类型定义调试时的数据显C。Natvis使用?jin)XML文gQ可L更好,易于实现?

本文使用Visual Studio的Natvis框架Q来对OpenCASCADE中的一些容器类数据q行可视化,方便开发者对OpenCASCADE的调试?

2.For Array Container

对于OpenCASCADE的包TColStd中的数组c,定义其natvis如下所C:(x)

<Type Name="TColStd_Array1OfInteger">
    
<DisplayString Condition="isAllocated != 1">empty</DisplayString> 
    
<DisplayString>{{size = {myUpperBound - myLowerBound + 1}}}</DisplayString>
    
<Expand>
        
<Item Condition="isAllocated == 1" Name="[size]">myUpperBound - myLowerBound + 1</Item>
        
<ArrayItems Condition="isAllocated == 1">
            
<Size>myUpperBound - myLowerBound + 1</Size>
            
<ValuePointer>(Standard_Integer*)(myStart) + myLowerBound</ValuePointer>
        
</ArrayItems>
    
</Expand>
</Type>

调试时数据显C如下图2.1所C:(x)

wps_clip_image-9252

Figure 2.1 OpenCASCADE array in Locals Windows

同理Q可Ҏ(gu)包中其他一l数l用同L(fng)规则Q即可对其中的数据可视化Q与std::vector昄的效果一P方便调试?

3.For List Container

对于OpenCASCADE的包TColStd中的链表c,定义其natvis如下所C:(x)

<Type Name="TColStd_ListNodeOfListOfInteger">
    
<DisplayString>{{current = {myValue}}}</DisplayString>
    
<Expand>
        
<LinkedListItems>
            
<HeadPointer>this</HeadPointer>
            
<NextPointer>(TColStd_ListNodeOfListOfInteger*)myNext</NextPointer>
            
<ValueNode>this-&gt;myValue</ValueNode>
        
</LinkedListItems>
    
</Expand>
</Type>

<Type Name="TColStd_ListOfInteger">
    
<DisplayString Condition="myFirst == 0">empty</DisplayString>
    
<Expand>
        
<Item Name="first">(TColStd_ListNodeOfListOfInteger*)myFirst</Item>
    
</Expand>
</Type>

调试时对于类TColStd_ListOfIntegerQnatvis诊断说找不到cTColStd_ListNodeOfListOfInteger定义Q当跟踪到此cM个具体函数时Q就可以看到具体的g(jin)Q?

wps_clip_image-12159

Figure 3.1 Natvis gives a Error info

跟踪到TColStd_ListOfInteger内部后,可以看到类TColStd_ListNodeOfListOfInteger中的数据?jin),但是从TColStd_ListOfInteger的函C出来后,q不到?jin)?

如果q个问题解决?jin),对于cTopoDS_ListOfShape中的数据也可以用同样的方式来昄Q极大地方便?jin)开发者对其调试。如果你Ҏ(gu)有解军_法,Ƣ迎不吝赐教?

wps_clip_image-11017

Figure 3.2 Data view for TColStd_ListNodeOfListOfInteger

先从单的容器cȝ手,解决后可TopoDS_ListOfShape中的数据昄出来Qؓ(f)OpenCASCADEE序的调试提供方ѝ?

4.Conclusion

Visual Studio 2012版本以后引入?jin)Natvis框架来对自定义的c进行可视化Q方便调试。OpenCASCADE中有很多容器cȝ接用了(jin)指针Q调试程序时数据很不直观。应用Natvis来对一些类在调试时的视图进行配|,可以方便查看其中数据QOpenCASCADE的调试更L?

对于一l数l的natvis定义q是很简单的Q但是对于List出现?jin)问题。如果这个问题解决了(jin)Q对TopoDS_ListOfShape的可视化也可做同L(fng)处理Q方侉K型法调试。若(zhn)有解决Ҏ(gu)Q望不吝赐教?

5. References

1. Create custom views of native objects in the debugger. 

https://msdn.microsoft.com/en-us/library/vstudio/jj620914.aspx

2. Writing debugger type visualizers for C++ using .natvis files

https://code.msdn.microsoft.com/Writing-type-visualizers-2eae77a2#content

3. vczh. C++实用技巧之配置Visual C++的调试器昄数据l构的格?

http://www.shnenglu.com/vczh/archive/2013/03/21/198665.html

4. stl.natvis in %VSINSTALLDIR%\Common7\Packages\Debugger\Visualizers

5. qt5.natvis in %VSINSTALLDIR%\Common7\Packages\Debugger\Visualizers



eryar 2015-01-31 19:16 发表评论
]]>
Iterate Files by Tcltkhttp://www.shnenglu.com/eryar/archive/2015/01/18/209566.htmleryareryarSun, 18 Jan 2015 04:08:00 GMThttp://www.shnenglu.com/eryar/archive/2015/01/18/209566.htmlhttp://www.shnenglu.com/eryar/comments/209566.htmlhttp://www.shnenglu.com/eryar/archive/2015/01/18/209566.html#Feedback0http://www.shnenglu.com/eryar/comments/commentRss/209566.htmlhttp://www.shnenglu.com/eryar/services/trackbacks/209566.htmlIterate Files by Tcltk

eryar@163.com

Abstract. Tcl/Tk provide a programming system for developing and using graphical user interface(GUI) applications. Tcl stands for “tool command language” and is pronounced “tickle”, is a simple scripting language for controlling the extending applications. The blog use Tcl/Tk to iterate all the files for a given directory, this is useful to some automation work, such as change all the file names for a given directory; add copyright info for the source code files.

Key Words. Tcl/Tk, Iterate FilesQ遍历文件夹中所有文?

1. Introduction

Tcl/Tk是一U用于易于用的脚本语言Q可以用来对E序q行扩展?qing)完成一些自动化的工作,加上内置的一些命令,其功能要比Windows中的DOS的批处理命o(h)功能更强大,使用更方ѝTcl脚本语言是开源免费的Q可以方便获取且免费使用?

OpenCASCADE中用了(jin)Tcl/Tk来实C(jin)一个自动化试体系。用在OpenCASCADE中用自定义的Tcl命o(h)Q可以快速来(g)验算法的l果。通过~写脚本文gQ实C(jin)试的自动化。所以学?fn)一下Tcl/Tk脚本语言Qƈ在实际的工作中加以应用,可以一些机械的力_交给计算动完成?

本文主要说明如何使用Tcl/Tk来遍历指定文件夹中所有文件。利用此功能Q可以稍微加以扩展,可以完成一些实际的重复力_。如遍历指定目录中所有的源文件或指定cd的文Ӟd上版权信息等?

2. Tcl/Tk Code

要遍历指定目录下所有的文gQ包括子文g夹,需要用到命令glob?qing)一个递归函数。脚本代码如下所C:(x)

#
# Tcl/Tk script to iterate all the files for a given directory.
# eryar@163.com
# 2015-01-18
#


package require Tcl
package require Tk

wm title 
. "Iterate Files"

label 
.labelDirectory -text "Directory "
entry 
.entryDirectory -width 30 -relief sunken -textvariable aDirectory
button 
.buttonDirectory -text "" -command {chooseDirectory .entryDirectory}

button 
.buttonApply -text "Apply" -command {perform $aDirectory}
button 
.buttonCancel -text "Cancel" -command {exit}

grid 
.labelDirectory .entryDirectory .buttonDirectory
grid 
.buttonApply .buttonCancel

# chooseDirectory--
# choose the directory to iterate.

proc chooseDirectory {theEntry} {
    set dir [tk_chooseDirectory 
-initialdir [pwd] -mustexist 1]
    
    
if {[string compare $dir ""]} {
        
$theEntry delete 0 end
        
$theEntry insert 0 $dir
        
$theEntry xview end
    }
}

# perform--
# perform the algorithm.
#

proc perform {theDirectory} {
    puts 
"Iterate all the files in $theDirectory"
    
    
if {[string length $theDirectory< 1} {
        tk_messageBox 
-type ok -icon warning -message "Please select the directory!" -parent .
        
return 
    }
    
    
# process the iterate
    process $theDirectory
}

# process--
# recursion every folder and file.
#

proc process {theFolder} {

    set aFiles [
glob -nocomplain -directory $theFolder *]
    
    
foreach aFile $aFiles {
        
if {[file isfile $aFile]} {
            
# just output the file name here. 
            # you can do something such as rename for the file.

            puts "$aFile \n"
        } 
else {
            process 
$aFile
        }
    }
}

E序用法为打开Tcl解释器,使用命o(h)source加蝲脚本文gQ如下图所C:(x)

wps_clip_image-20196

Figure 2.1 Tcl usage

3. Conclusion

通过应用Tcl/Tk来体验脚本编E的乐趣Qƈ加深对Tcl/Tk的理解。从而对OpenCASCADE的模块Draw Test Harness更好地理解?

如果有编E基QTcl/Tk?x)很快入门的。入门后Q可以应用其直接~写一些有意思有脚本Q来实现一些重复工作的自动化。也可将Tcl加入到自qE序中,增加E序的二ơ开发功能?

可见Q玩一玩脚本语aQ还是非常有的Q?/p>


PDF Version and Script: Iterate Files by Tcl



eryar 2015-01-18 12:08 发表评论
]]>
AutoCAD File Mergerhttp://www.shnenglu.com/eryar/archive/2015/01/15/AutoCAD_File_Merger.htmleryareryarThu, 15 Jan 2015 11:32:00 GMThttp://www.shnenglu.com/eryar/archive/2015/01/15/AutoCAD_File_Merger.htmlhttp://www.shnenglu.com/eryar/comments/209538.htmlhttp://www.shnenglu.com/eryar/archive/2015/01/15/AutoCAD_File_Merger.html#Feedback3http://www.shnenglu.com/eryar/comments/commentRss/209538.htmlhttp://www.shnenglu.com/eryar/services/trackbacks/209538.htmlAutoCAD File Merger

eryar@163.com

Abstract. There are many drawing files during the ship design or other design process, so somebody want to merge them to one DWG file. The DwgMerger is a AutoCADE plugin developed by AutoCAD .NET, its purpose is to merge all the drawing files, include dwg and dxf format to one drawing paper.

Key Words. AutoCAD, DWG, DXF, Merger, 合ƈ

1. Introduction

在工E设计过E中Q会(x)产生很多囄。像船舶生设计的管pd图,有的区域或分D会(x)产生几百张管子零件图。ؓ(f)?jin)便于图U的理?qing)打华ͼ需要将q些囄合ƈC张图U怸。ؓ(f)此,利用AutoCAD .NET开发一个小插gDwgMergerQ来实现q个功能?

原来直接得用C++开发一个不依赖AutoCAD的合qDXF文g的小E序DxfMergerQ详见:(x)http://www.shnenglu.com/eryar/archive/2012/07/12/183053.aspx 。但是这个程序有很多局限性,如只能处理比较低版本的DXFQ不能处理DWG格式{,所以迟q没有发布出来。考虑到有q些DXFQDWG格式的图U的用户都会(x)安装AutoCADQ所以决定直接用AutoCAD .NET来开发一个插Ӟq样没有什么限制了(jin)。不仅能合ƈDXF文gQ还能合qDWG文g。只要你的AutoCAD能打得开的图U文Ӟ应该都能q行合ƈ?

E序开发环境ؓ(f)AutoCAD2012Q程序运行环境ؓ(f)QAutoCAD2010, 2012{?

2.Usage

因ؓ(f)是用AutoCAD .NET开发的Q所以程序的用法和其他AutoCAD .NET插g一致。步骤如下:(x)

v 打开AutoCADQ输入命令:(x)netloadQ如下图所C:(x)

wps_clip_image-14472

v 程序复制到AutoCAD的安装目录,q加载DwgMerger.dllE序集,如下图所C:(x)

wps_clip_image-23031

v 加蝲成功后,输入命o(h)QmergeQ会(x)打开E序ȝ面如下图所C:(x)

wps_clip_image-5880

v 在文件列表上右键Q添加要合ƈ的图U文Ӟ可以通过d文g夹的方式Q也可以通过选择文g的方式,如下图所C:(x)

wps_clip_image-9280

v 讄要合q图U的寸Q默认尺ؓ(f)A4大小的,可以Ҏ(gu)实际需要修改;

v 讄合ƈ后陈列一行的囄数量Q默认ؓ(f)每行10张;

v ApplyQ?

生成效果囑֦下所C:(x)

wps_clip_image-30454

 

Download DwgMerger: DwgMerger



eryar 2015-01-15 19:32 发表评论
]]>
t脚张望的时?/title><link>http://www.shnenglu.com/eryar/archive/2014/10/27/208687.html</link><dc:creator>eryar</dc:creator><author>eryar</author><pubDate>Mon, 27 Oct 2014 11:48:00 GMT</pubDate><guid>http://www.shnenglu.com/eryar/archive/2014/10/27/208687.html</guid><wfw:comment>http://www.shnenglu.com/eryar/comments/208687.html</wfw:comment><comments>http://www.shnenglu.com/eryar/archive/2014/10/27/208687.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/eryar/comments/commentRss/208687.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/eryar/services/trackbacks/208687.html</trackback:ping><description><![CDATA[<font color="#cc0000" face="微Y雅黑">                    </font> <blockquote style="padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px 0px 0px 40px; padding-right: 0px"> <blockquote style="padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px 0px 0px 40px; padding-right: 0px"> <p style="margin-bottom: 0px; padding-bottom: 0px; padding-top: 0px; margin-top: 0px"><span style="font-size: 16px; font-family: 'Microsoft YaHei'; color: rgb(0,153,0)"><font color="#cc0000">有一天你破蛹而出Q成长得比h们期待的q要丽?/font> <br />但这个过E会(x)很痛Q会(x)很辛苦,有时候还?sh)(x)觉得灰心(j)?/span></p></blockquote></blockquote> <blockquote style="padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px 0px 0px 40px; padding-right: 0px"> <blockquote style="padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px 0px 0px 40px; padding-right: 0px"> <p style="margin-bottom: 0px; padding-bottom: 0px; padding-top: 0px; margin-top: 0px"><span style="color: rgb(102,0,204)"><span style="font-size: 16px; font-family: 'Microsoft YaHei'">面对着Ҏ(gu)</span><span style="font-size: 16px; font-family: 'Microsoft YaHei'">而来的现实,</span><span style="font-size: 16px; font-family: 'Microsoft YaHei'">觉得自己渺小无力?/span></span></p></blockquote></blockquote> <blockquote style="padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px 0px 0px 40px; padding-right: 0px"> <blockquote style="padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px 0px 0px 40px; padding-right: 0px"> <p style="margin-bottom: 0px; padding-bottom: 0px; padding-top: 0px; margin-top: 0px"><span style="font-size: 16px; font-family: 'Microsoft YaHei'"><span style="color: rgb(204,153,51)">但这Q也是生命的一部分?/span></span><span style="font-size: 16px; font-family: 'Microsoft YaHei'; color: rgb(204,153,51)">做好现在你能做的Q然后,一切都?x)好的?/span></p></blockquote></blockquote> <blockquote style="padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px 0px 0px 40px; padding-right: 0px"> <blockquote style="padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px 0px 0px 40px; padding-right: 0px"> <p style="margin-bottom: 0px; padding-bottom: 0px; padding-top: 0px; margin-top: 0px"><span style="color: rgb(204,51,204)"><span style="font-size: 16px; font-family: 'Microsoft YaHei'">我们都将孤独地长</span><span style="font-size: 16px; font-family: 'Microsoft YaHei'">大,不要x(chng)?/span></span></p></blockquote></blockquote> <p style="margin-bottom: 0px; font-size: 14px; font-family: Arial; padding-bottom: 0px; text-align: left; padding-top: 0px; margin-top: 0px; line-height: 26px"><br /></p> <p style="margin-bottom: 0px; font-size: 14px; font-family: Arial; padding-bottom: 0px; text-align: left; padding-top: 0px; margin-top: 0px; line-height: 26px"><span style="font-size: 16px; font-family: 'Microsoft YaHei'"><span style="white-space: pre"></span>—— 寂地《踮脚张望的时光?/span></p> <p style="margin-bottom: 0px; font-size: 14px; font-family: Arial; padding-bottom: 0px; text-align: left; padding-top: 0px; margin-top: 0px; line-height: 26px"><span style="font-size: 16px; font-family: 'Microsoft YaHei'"></span> </p> <img src ="http://www.shnenglu.com/eryar/aggbug/208687.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/eryar/" target="_blank">eryar</a> 2014-10-27 19:48 <a href="http://www.shnenglu.com/eryar/archive/2014/10/27/208687.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Try to use Debianhttp://www.shnenglu.com/eryar/archive/2014/09/29/208456.htmleryareryarMon, 29 Sep 2014 14:54:00 GMThttp://www.shnenglu.com/eryar/archive/2014/09/29/208456.htmlhttp://www.shnenglu.com/eryar/comments/208456.htmlhttp://www.shnenglu.com/eryar/archive/2014/09/29/208456.html#Feedback0http://www.shnenglu.com/eryar/comments/commentRss/208456.htmlhttp://www.shnenglu.com/eryar/services/trackbacks/208456.htmlTry to use Debian

eryar@163.com

Debian是OpenCASCADE用于Linux操作pȝ试的专用系l。这几天下蝲安装?jin)DebianpȝQ体验了(jin)一下,感觉q(sh)错:(x)z,_致?

wps_clip_image-23936

Figure 1. Debian GUI

wps_clip_image-9270

Figure 2. Debian GUI

安装Debian也ƈ不是一帆风,和刚开始自己安装Windows操作pȝ一P也遇C(jin)些小问题。不q把q些都解军_QDebian用v来感觉很对味?

v 昑֍驱动

首先遇到是显卡驱动没有正安装。由于笔记本是ATI的显卡,使用pȝ自带的驱动还?sh)行。在|上搜了(jin)很多Ҏ(gu)Q最l还是用官网上的Ҏ(gu)成功解决问题?

wps_clip_image-25492

Figure 3. The ATI Radeon HD Drivers Installation in Debian

选择昑֍对应型号的驱动,一定要?#8221;Contrib”?#8221;non-free”加到sources.list中去Q如上图所C。然后再直接执行下面两条命o(h)卛_?

详情可参考:(x)https://wiki.debian.org/ATIProprietary ?

使用命o(h)Qglxgears来测试一?D的性能Q?

wps_clip_image-30702

由图可知Q这个简单的3DE序得到的频是2000 FPS左右Q比OpenSceneGraph在Windows下的要高多了(jin)。(q个W记本的昑֍q是比较老的。)(j)

v览器的Flash 插g

览器Iceweasel默认没有把Flash插g安装好,D一些在UK乐和?sh)?jing)不能播放。在|上也搜索了(jin)很多Q结果还是按官网上的Ҏ(gu)搞定。其中主要还是要把源讄好,p自动安装?jin)。安装方法如下所C:(x)

wps_clip_image-23730

Figure 4. Flash Player Plugin for Iceweasel

有了(jin)Flash可以边听歌边写代码?jin)?

详情可参考:(x)https://wiki.debian.org/FlashPlayer/ ?

v 输入法fcitx

先设|系l的localesQ其中包含中文字库。再安装f(xi)citxQ按|上的操作也实现?jin)英文的pȝ中文的输入?

ȝ

解决?jin)这些问题后QDebian用v来感觉还好,q需要慢慢熟(zhn)和适应。下一步准备在Debian上编译、调试C/C++E序。ؓ(f)~译OpenCASCADE的Linux版本打下基础?



eryar 2014-09-29 22:54 发表评论
]]>
Intergraph Stamphttp://www.shnenglu.com/eryar/archive/2014/07/26/207813.htmleryareryarSat, 26 Jul 2014 09:36:00 GMThttp://www.shnenglu.com/eryar/archive/2014/07/26/207813.htmlhttp://www.shnenglu.com/eryar/comments/207813.htmlhttp://www.shnenglu.com/eryar/archive/2014/07/26/207813.html#Feedback0http://www.shnenglu.com/eryar/comments/commentRss/207813.htmlhttp://www.shnenglu.com/eryar/services/trackbacks/207813.html20140726_163951

20140726_165500

感谢胖师兄Q这个印章很有味道?/p>

eryar 2014-07-26 17:36 发表评论
]]>
std::ofstream failedhttp://www.shnenglu.com/eryar/archive/2014/07/12/207627.htmleryareryarSat, 12 Jul 2014 07:55:00 GMThttp://www.shnenglu.com/eryar/archive/2014/07/12/207627.htmlhttp://www.shnenglu.com/eryar/comments/207627.htmlhttp://www.shnenglu.com/eryar/archive/2014/07/12/207627.html#Feedback3http://www.shnenglu.com/eryar/comments/commentRss/207627.htmlhttp://www.shnenglu.com/eryar/services/trackbacks/207627.html今天在输出数据到文gӞ用到C++的std::ofstreamQ结果文件就是没有输出成功,CZE序如下所C:(x)


#include 
<fstream>
#include 
<sstream>
#include 
<iostream>
#include 
<cassert>

void Output(const std::string &theFileName)
{
    std::ofstream os(theFileName.c_str());

    assert(os.good());

    os 
<< "Just for test" << std::endl;

    os.close();
}

int main(int argc, char* argv[])
{
    std::stringstream ss;

    
// remove the std::endl
    ss << "test" << 1 << ".txt" << std::endl;

    Output(ss.str());

    
return 0;
}

 

最后才发现是文件名有问题,修改E序Q去掉生成文件名的一个std::endl卛_Q?/p>

 


#include 
<fstream>
#include 
<sstream>
#include 
<iostream>
#include 
<cassert>

void Output(const std::string &theFileName)
{
    std::ofstream os(theFileName.c_str());

    assert(os.good());

    os 
<< "Just for test" << std::endl;

    os.close();
}

int main(int argc, char* argv[])
{
    std::stringstream ss;

    
// remove the std::endl
    ss << "test" << 1 << ".txt";

    Output(ss.str());

    
return 0;
}


不经意间׃(x)写出q种错误的代码Q而且N很很Ҏ(gu)?/p>

eryar 2014-07-12 15:55 发表评论
]]>
Mesh Photoshttp://www.shnenglu.com/eryar/archive/2013/09/20/203321.htmleryareryarFri, 20 Sep 2013 14:50:00 GMThttp://www.shnenglu.com/eryar/archive/2013/09/20/203321.htmlhttp://www.shnenglu.com/eryar/comments/203321.htmlhttp://www.shnenglu.com/eryar/archive/2013/09/20/203321.html#Feedback2http://www.shnenglu.com/eryar/comments/commentRss/203321.htmlhttp://www.shnenglu.com/eryar/services/trackbacks/203321.html20130920_120035

Figure 1. HangzhouDong Railway Station

20130920_120100

Figure 2. Railway station roof

 

中秋L州玩Q看到杭州东火R站屋很有感觉,拍?jin)几张照片。看着那造型Q联惛_曲面造型Q即可以用多边Ş来表C由曲面?/p>

eryar 2013-09-20 22:50 发表评论
]]>
只要路是对的Q就不怕\q?/title><link>http://www.shnenglu.com/eryar/archive/2013/08/19/202655.html</link><dc:creator>eryar</dc:creator><author>eryar</author><pubDate>Mon, 19 Aug 2013 14:30:00 GMT</pubDate><guid>http://www.shnenglu.com/eryar/archive/2013/08/19/202655.html</guid><wfw:comment>http://www.shnenglu.com/eryar/comments/202655.html</wfw:comment><comments>http://www.shnenglu.com/eryar/archive/2013/08/19/202655.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/eryar/comments/commentRss/202655.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/eryar/services/trackbacks/202655.html</trackback:ping><description><![CDATA[<p>1. U极思考造成U极人生Q消极思考造成消极人生Q?/p> <p>2. 别想一下造出大vQ必d由小沛_开始;</p> <p>3. 你有脸是Z(jin)呈现上帝赐给人类最贵重的礼?#8212;—微笑Q一定要成ؓ(f)你工作最大的资Q?/p> <p>4. 以诚感h者,Z诚而应Q?/p> <p>5. 即不成熟的试Q也胜于胎死腹中的策略;</p> <p>6. U极者相信只有推动自己,才能推动世界Q只要推动自己,p推动世界Q?/p> <p>7. 行动是成功的阶梯Q行动越多,d高Q?/p> <p>8. 不要{待Z(x)Q而要创徏Z(x)Q?/p> <p>9. 成功的法则极为简单,但简单ƈ不代表容易;</p> <p>10. 昨晚多几分钟的准备,今天几时的麻?ch)?/p> <p>11. 世界上那些最Ҏ(gu)的事情中Q拖延时间最不费力;</p> <p>12. 未曾p|的h恐怕也未曾成功q;</p> <p>13. 挫折其实是q向成功所应缴的学费;</p> <p>14. M的限刉是从自己的内?j)开始的Q?/p> <p>15. 忘掉p|Q不q要牢记p|中的教训Q?/p> <p>16. 不是境况造就人,而h造就境况Q?/p> <p>17. 靠山׃(x)倒,靠水水会(x),靠自己永q不倒;</p> <p>18. 只要路是对的Q就不怕\q;</p> <p>19. 一个能从别人的观念来看事情Q能?jin)解别h?j)灵zd的hQ永q不必ؓ(f)自己的前途担?j)?/p> <p>20. 当一个h先从自己内心(j)开始奋斗,他就是个有h(hun)值的人;</p> <p>21. 生命Ҏ(gu)些h来说是美丽的Q这些h的一生都为某个目标而奋斗;</p> <p>22. 凡真?j)尝试助,没有不帮到自q?/p><img src ="http://www.shnenglu.com/eryar/aggbug/202655.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/eryar/" target="_blank">eryar</a> 2013-08-19 22:30 <a href="http://www.shnenglu.com/eryar/archive/2013/08/19/202655.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>三维CAD?/title><link>http://www.shnenglu.com/eryar/archive/2013/05/05/199997.html</link><dc:creator>eryar</dc:creator><author>eryar</author><pubDate>Sun, 05 May 2013 14:15:00 GMT</pubDate><guid>http://www.shnenglu.com/eryar/archive/2013/05/05/199997.html</guid><wfw:comment>http://www.shnenglu.com/eryar/comments/199997.html</wfw:comment><comments>http://www.shnenglu.com/eryar/archive/2013/05/05/199997.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.shnenglu.com/eryar/comments/commentRss/199997.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/eryar/services/trackbacks/199997.html</trackback:ping><description><![CDATA[<p>        企业应用三维CADq行产品创新设计已经是一各必然趋势,三维设计W合人的思维?fn)惯。在二维CAD普及(qing)的今天,三维CAD也就成ؓ(f)我国加快实现工业C化的必然选择Q其对制造业增强产品创新开发能力vC(jin)巨大的推动作用,是制造业信息C化徏设不可或~的工具。然而目前我国制造业中普?qing)三lCADq存在许多现实的问题Q三lCAD软g的业化开发水q不如二维CAD软g。因此,发展h自主知识产权的三lCAD软gQ打破国外品的垄断局面,成ؓ(f)一w常迫切的d?/p> <p>       CAD技术经q几十年的发展,先后走过?jin)大型机、小型机、工作站、微机时代,每个时代都有当时行的CAD软g。下面分别介l一些流行的可用于曲面造型的YӞ(x)</p> <ul><li>国SDRC公司的IQDEAS Master Series软g采用VGXQ超变量Q技术,用户可以直观、实时地q行三维产品的设计和修改Q?/li><li>国UGQUnigraphics SolutionsQ源于航IZ、汽车业Q以参数化实体几何造型核心(j)为基Q采用基于约束的特征建模和传l的几何建模Z体的复合建模技术。其曲面功能包含于Freeform Modeling模块中,采用?jin)NURBS、Bh、Bezier数学基础Q同时保留解析几何实体造型Ҏ(gu)Q造型能力强;</li><li>国PTC公司的Pro/Engineer以其参数化、基于特征、全相关{新概念d于CAD界,其曲面造型集中在Pro/SURFACE模块中;</li><li>国IBM的CATIA/CADAM(Dassault Systems开?是一个广泛的CAD、CAM、CAE、PDM应用pȝ?/li><li>法国Matra-DataVision公司的Euclid集成pȝ是一个集机械设计与工厂设计于一w企业q行工程解决Ҏ(gu)Q其曲面功能?#8220;ASD高曲面设计”之中。曲面由NURBS和Bezier数学形式表达Q通过强大的蒙皮、扭曌Ӏ放栗裁剪、布?yu)(dng)运,能够形成复杂的外形。其实体造型功能可直接用于曲面,表现出突出的拓朴q算能力。例如,多曲面间的交、ƈ、差q算Q在多曲面间的空隙处填充成保持一致切矢、曲率的新曲面;构造相切于已知曲面的曲面等。Euclid动态自由造型功能Q实C(jin)以曲面曲率进行动态曲面追t、编辑、控制的设计修改q程Q很好地体现?jin)交互技术的应用。Matra公司的另一专业应用pȝStrim专门针对复杂曲面CAD、CAE、CAMQ其曲面设计和模具制造能力优?sh)Euclidpȝ。这主要表现在曲面模型质量检查器、曲面重建、逆向工程与工业造型设计{专业模块上。尤其是其数字化点加工能力,卛_以根据坐标测量机得的数据点直接q行加工E序的编Ӟ而不必构造曲面模型。MQ这两个软g曲面能力实力最强。Matra-DataVision是现在的Open Cascade的历史可以参考:(x)<a title="http://www.opencascade.org/about/profile/history/" >http://www.opencascade.org/about/profile/history/</a>?/li><li>国CV公司的CADDS5软g的NURBS曲面设计模块是CV公司用以完成大型复杂曲面造型的专用工兗?/li><li>Solid Edge采用Parasolid造型内核。MDT以ACIS模型为核?j),可以对NURBS曲面q行多种几何处理Qƈ且结合到l一的实体环境中?/li></ul><img src ="http://www.shnenglu.com/eryar/aggbug/199997.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/eryar/" target="_blank">eryar</a> 2013-05-05 22:15 <a href="http://www.shnenglu.com/eryar/archive/2013/05/05/199997.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>假如 If&hellip;http://www.shnenglu.com/eryar/archive/2012/12/15/196339.htmleryareryarSat, 15 Dec 2012 15:30:00 GMThttp://www.shnenglu.com/eryar/archive/2012/12/15/196339.htmlhttp://www.shnenglu.com/eryar/comments/196339.htmlhttp://www.shnenglu.com/eryar/archive/2012/12/15/196339.html#Feedback3http://www.shnenglu.com/eryar/comments/commentRss/196339.htmlhttp://www.shnenglu.com/eryar/services/trackbacks/196339.html假如…

eryar@163.com

假如昄器的分L率可以趋于无限,

那么我将?em>glVertexd充满柔情的弧U和飘逸洒q面片?


假如不去理会(x)Ƨ拉C性数是否{于2的约束,

那么我将?em>NURBS创造一个柏拉图的自q惛_度?

clip_image006
up

假如爱情可以不再功利世俗Q?

那么我将与CAGD携手ZQ相守一生?



eryar 2012-12-15 23:30 发表评论
]]>
[转]一个小时内学习(fn) SQLite 数据?/title><link>http://www.shnenglu.com/eryar/archive/2012/10/27/193952.html</link><dc:creator>eryar</dc:creator><author>eryar</author><pubDate>Sat, 27 Oct 2012 13:23:00 GMT</pubDate><guid>http://www.shnenglu.com/eryar/archive/2012/10/27/193952.html</guid><wfw:comment>http://www.shnenglu.com/eryar/comments/193952.html</wfw:comment><comments>http://www.shnenglu.com/eryar/archive/2012/10/27/193952.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/eryar/comments/commentRss/193952.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/eryar/services/trackbacks/193952.html</trackback:ping><description><![CDATA[     摘要: 1. 介绍 SQLite 是一个开源的嵌入式关pL据库Q实现自包容、零配置、支持事务的SQL数据库引擎?其特Ҏ(gu)高度便携、用方ѝ结构紧凑、高效、可靠?与其他数据库理pȝ不同QSQLite 的安装和q行非常单,在大多数情况?- 只要保SQLite的二q制文g存在卛_开始创建、连接和使用数据库。如果?zhn)正在L一个嵌入式数据库项目或解决Ҏ(gu)QSQLite是绝对值得考虑?. ?..  <a href='http://www.shnenglu.com/eryar/archive/2012/10/27/193952.html'>阅读全文</a><img src ="http://www.shnenglu.com/eryar/aggbug/193952.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/eryar/" target="_blank">eryar</a> 2012-10-27 21:23 <a href="http://www.shnenglu.com/eryar/archive/2012/10/27/193952.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>再读《赤壁赋?/title><link>http://www.shnenglu.com/eryar/archive/2012/07/12/183059.html</link><dc:creator>eryar</dc:creator><author>eryar</author><pubDate>Thu, 12 Jul 2012 13:58:00 GMT</pubDate><guid>http://www.shnenglu.com/eryar/archive/2012/07/12/183059.html</guid><wfw:comment>http://www.shnenglu.com/eryar/comments/183059.html</wfw:comment><comments>http://www.shnenglu.com/eryar/archive/2012/07/12/183059.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/eryar/comments/commentRss/183059.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/eryar/services/trackbacks/183059.html</trackback:ping><description><![CDATA[<p>     看到苏轼写《赤壁赋》的背景Q他思想是矛盄Q一斚wQ他对受到残(hu)h?yn)L到愤懑、痛苦;另一斚wQ时时想从老庄?jng)学求得解脱。同Ӟ在躬耕农事与田父野老的交往中,感到?jin)温暖,增强了(jin)信心(j),也他的思想更接q现实。说明当你很pӞ可以使自己忙h。这也应该是古h在谈人生Q谈理想的文章。现摘抄如下Q?/p> <div id="fd9pxbp" class="csharpcode"><pre class="alt"> 壬戌之秋Q七月既望,苏子与客泛舟怺赤壁之下。清风徐来,水L不兴。D酒属客,诉|?/pre><pre>诗,歌窈H之章。少焉,月出于东׃上,徘徊于斗牛之间。白露横江,水光接天。纵一苇之所如,凌万之茫然。浩乎如冯虚M风,而不知其所止;飘飘?sh)如遗世独立Q羽化而登仙?/pre><pre>  于是饮酒乐甚Q扣舯(g)歌之。歌曎ͼ(x)“桂棹兮兰桨,ȝ明兮溯流光。ؓ(f)渺兮于怀Q望h兮天</pre><pre class="alt">一斏V?#8221;客有Ҏ(gu)者,倚歌而和之。其声呜呜然Q如怨如慕,如泣如诉Q余韌袅,不绝如缕。舞</pre><pre>q壑之潜蛟,泣孤舟之嫠妇?/pre><pre>  苏子愀?dng)正襟危坐而问客曰Q?#8220;何ؓ(f)其然也?”客曰Q?#8220;‘月明星稀Q乌鹊南?#8217;Q此非曹孟d之诗乎?西望夏口Q东望武昌,山川相缪Q郁乎苍苍,此非孟d之困于周郎者乎Q方其破荆州Q下江陵Q顺而东也,<br />舌千里Q旌旗蔽I,N临江Q横槊赋诗,Z世之雄也Q而今安在哉?况吾与子渔樵于江渚之上,侣鱼虾而友p鹿Q驾一叶之扁舟QD匏樽以相属。寄蜉蝣与天圎ͼ渺之一_。哀各之须臾,长江之无穷?br />挟飞仙以遨游Q抱明月而长l。知不可乎骤得,托遗响于(zhn)风?#8221;</pre><pre>  苏子曎ͼ(x)“客亦知夫水与月乎Q逝者如斯,而未往也;盈虚者如|而卒莫消长也。盖自其变者而观之,则天地曾不能以一瞬;自其不变者而观之,则物与我皆无也。而又何M乎!且夫天地之间Q物各有主,<br />苟非吾之所有,虽一毫而莫取。惟江上之清风,与山间之明月Q耛_之而ؓ(f)壎ͼ目遇之而成Ԍ取之无禁Q用之不竭,是造物者之无尽藏也Q而吾与子之所共适?#8221;</pre><pre>  客喜而笑Q洗盏更酌。肴核既,杯盘狼籍。相与枕藉乎舟中Q不知东方之既白?/pre></div><img src ="http://www.shnenglu.com/eryar/aggbug/183059.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/eryar/" target="_blank">eryar</a> 2012-07-12 21:58 <a href="http://www.shnenglu.com/eryar/archive/2012/07/12/183059.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>创造有价值的人生http://www.shnenglu.com/eryar/archive/2012/06/30/180917.htmleryareryarSat, 30 Jun 2012 12:22:00 GMThttp://www.shnenglu.com/eryar/archive/2012/06/30/180917.htmlhttp://www.shnenglu.com/eryar/comments/180917.htmlhttp://www.shnenglu.com/eryar/archive/2012/06/30/180917.html#Feedback0http://www.shnenglu.com/eryar/comments/commentRss/180917.htmlhttp://www.shnenglu.com/eryar/services/trackbacks/180917.html领?zhn)人生真?创造h生h(hun)?/h2>

一、树(wi)立正的人生?/h3>
  1. 世界观与人生?/strong>
    • 世界观是Z对生zd其中的世界以?qing)h与世界的关系的M看法和根本观炏V?
    • 人生观是世界观的重要l成部分Q是Z在实践中形成的对于h生目的和意义的根本看法,它决定着Z实践zd的目标、h生道路的方向和对待生zȝ态度。马克思指出:(x)人的本质不是单个人所固有的抽象物Q在其现实性上Q它是一切社?x)关pȝd?
    • M人都是处于一定的C会(x)关系中从事社?x)实跉|动的人。社?x)属性是人的本质属性,人的自然属性也深深打上?jin)社会(x)属性。每个h从他来到Z的那天vQ就从属于一定的C会(x)体Q同周围的h发生着各式各样的社?x)关p,如家庭关pR业~关pR道德关pR经关pR恋爱关pȝ。h们正是在q种客观的、现实的、不断变化的C会(x)关系中塑造自我,成ؓ(f)真正意义上的人,成ؓ(f)h个性特征的自我。在实际生活中,Z不断面对各式各样的问题,逐渐地认识和领?zhn)人生。到?jin)一定年龄,无论自觉与否Qh都会(x)形成与自q生活阅历、实际体验密切相关的关于人生的根本看法、h(hun)值判断和生活态度Q这是一个h的h生观?
    • 世界观与人生观是紧密联系在一L(fng)。正的世界观是正确人生观的基础Qh们对人生意义的正理解,需要v立在对世界发展客观规律正认识的基础之上。现实生z说明,一个h即曄?wi)立起?jin)正确的世界观Q但在h生实践中Q如果经不v拜金M、n乐主义和极端个hM{腐朽h生观的R蚀Q放弃了(jin)Zh民服务的人生观,那么Q正的世界观必然也?x)失?/li>
  1. q求高尚的h生目?

人生观主要通过人生目的、h生态度、h生h(hun)g个方面体现出来。h生目的回{hZ么活着Qh生态度表明人应当怎样对待生活Qh生h(hun)值判断什么样的h生才有意义?/p>

    • 人生目的军_人生道\。一斚wQh生目的规定了(jin)人生zd的大方向Q对Z所从事的具体活动v着定向作用。另一斚wQh生目的又是h生行为的动力源泉Qؓ(f)实现人生目的Qh们会(x)注重培养能力、磨l意志、奋发进取、努力拼搏?
    • 人生目的军_人生态度。h生道路崎岖不qI面对各种各样的矛监֒斗争Q不同的人生目的?x)人采取不同的人生态度。正的人生目的可以使h无所畏惧、顽强拼搏、积极进取、乐观向上;错误的h生目的则?x)h或是投机钻营、铤而走险、违法犯|、或是虚度h生、游戏h生、放Uh生、或是?zhn)观消沉、看破红沙、厌世轻生?
    • 人生目的军_人生价值标准。正的人生目的?x)人懂得h生的价值在于奉献,从而在工作中尽?j)尽力尽责;错误的h生目的则?x)人把人生价值理解ؓ(f)向社?x)或他hq行索取Q从而以q逐个人私利ؓ(f)有h(hun)倹{有意义的h生。不同的人生目的?x)有不同的h生选择Q不同的人生选择军_着不同的h生追求,不同的h生追求决定着不同的h生h(hun)倹{?/li>
  1. 立U极q取的h生态度
  • 人生态度和h生观Qh生态度是指Z通过生活实践形成的对人生问题的一U稳定的?j)理們֐和基本意ѝ每个h在h生实践中Q都?x)遇C利、荣辱、善恶、苦乐、得失、成败、祸、生ȝ人生矛盾Q如果以正确的h生态度对待和处理这些问题,可以正的把握人生Q取得h生的成功?
    • 人生态度是h生观的重要内宏V?
    • 人生态度是h生观的表现和反映?/li>
  • 端正人生态度Qh生态度既制U着一个h对h生矛监֒问题的认识与把握Q又影响着一个h的精状态和人生走向。在人生实践中会(x)遇到各种各样的矛监֒困难Q需要端正h生态度?
    • 人生认?/strong>Q以认真的态度对待人生Q对自己负责Q对家庭负责Q对国家和社?x)负责,自觉承担赯己应的责QQ满腔热情地投n于生zR工作和学习(fn)中,在ؓ(f)国家发展和社?x)进步A(ch)献力量的q程中实现自q人生价倹{?
    • 人生当务?/strong>Q要从h生的实际出发Q以U学的态度看待人生Q以务实的精创造h生,以求真务实的作风做好每g事。要把远大理惛_于具体的行动中,不能好高鹜远、空谈理惟뀁眼高手低、浅辄止,否则׃(x)q实际Q一事无成?
    • 人生应乐观;乐观向上Q热qz,对h生充满自信,体现?jin)对自己、对C会(x)、对生活的积极态度Q这U态度是h们承受困隑֒挫折的心(j)理基。h生是丰富多采的,也充满了(jin)各种矛盾。在人生的特定成镉KD,面对学习(fn)、就业、恋爱、婚ȝ各种实际问题Q不?x)L如人意、一切顺遂,也可能有失望、困难、挫折。要始终保持乐观向上的h生态度Q不能因为没满自己的期望或者遇到困难挫折,消极?zhn)观、畏N~、甚至颓废堕落、自暴自弃,更不能因此而轻生。要怿生活是美好的Q前途是光明的,遇事要想得开Q做?j)胸豁达Q在生活实践中不断调整心(j)态,练意志Q优化性格QŞ成热q命,乐观向上的h生态度?
    • 人生要进?/strong>Qh生实践就是一个创造过E。适应历史发展势Q以开拓进取的态度q接人生的种?xi)战Q就能不断领(zhn)美好h生的真谛Q体验生zȝ快乐和幸。要U极q取Q不断丰富h生的意义Q不能贪囑֮逸、满现状、因循守旧、碌无为。要发扬自强不息、敢Zh先、百折(sh)挠、坚忍不拔的_Q始l保持蓬勃朝气、昂扬锐气,充分发挥生命的创造力Q在Z利、ؓ(f)C会(x)作A(ch)献中努力提升生命的h(hun)|在创造中书写人生的灿烂篇章?/li>
  1. 用科学高的人生观指引h?/strong>

一个树(wi)立了(jin)Zh民服务h生观的hQ就能对人生的目的有更ؓ(f)深刻的理解,时时处处Zh民着惻I助hZQ造福人民Q成Zh受h民欢q的人。一个h的能力有大小Q职业有不同Q但只要U学认识人生目的Q切实把人民利益攑֜首位Q以人民利益为重Q不为狭隘私?j)所扎ͼ不ؓ(f)华名利所累,不ؓ(f)低俗物欲所惑,p够不断实践高的人生价倹{全?j)全意?f)人民服务的精,毫不利己Q专门利人的_应当成ؓ(f)我们时代最崇高的精?/p>

人的一生M(x)遇到各种各样的h生境遇,只要?wi)立Zh民服务的人生观,p以积极的?j)态看待h生的意义Q把个h的努力与人民的事业结合v来,胸怀q大理想Q积极投w社?x)实践,热爱生活Q珍视生命,用坚忍不拔的意志勇敢战胜生活、学?fn)和工作中种U困隑֒挫折Q在不断的开拓h生更高境界中领会(x)生活的美好?/p>

二、创造有价值的人生

  • 价D与h生h(hun)?
    • 价D是h们关于什么是价倹{怎样评判价倹{如何创造h(hun)值等问题的根本观炏V?
    • 人生价值是一U特D的价|是h的生zd践对于社?x)和个h所h的作用的意义。选择什么样的目的,C么样的h生道路,如何处理生命历程中个ZC会(x)、现实与理想、付Z收获、n与心(j)、生ȝ一pd矛盾Qh们L有所取舍Q有所好恶Q对于赞成什么、反对什么,认同什么抵制什么,L一定的标准。h生h(hun)值就是h们从价D度考虑人生问题的根据?/li>
  • 人生价值的标准与评?
    • 人生的自我h(hun)gC会(x)价|
    • 人生价值的标准Qh生h(hun)DL(fng)Ҏ(gu)度是看一个h的h生活动是否符合社?x)发展的客观规律Q是否通过实践?j)进了(jin)历史的q步。劳动及(qing)通过力_对社?x)和他h作出的A(ch)献,是社?x)评价一个h的h生h(hun)值的普遍标准?
    • 人生价值的评h(hun)
      • 坚持能力有大与贡献d力相l一Q?
      • 坚持物质贡献与精A(ch)献相l一Q?
      • 坚持完善自n与A(ch)献社?x)相l一Q?
      • 坚持动机与效果相l一Q?/li>
  • 人生价值实现的条g
    • 人生价值实现的C会(x)条g
      • 实现人生价D从社?x)客观条件出发?
      • 人生价D目标要与C会(x)M核心(j)价gpȝ一_(d)
    • 人生价值实现的个h条g
      • 实现人生价D从个体自w条件出发。个体自w条件主要包括一个h的思想道d素质、科学文化素质、生理心(j)理素质等斚w的要素?
      • 不断提高自n能力Q增强实Ch生h(hun)值的本领。h在自然天赋上有差异,但这q不是说人的主观努力不v作用。个人的主观努力Q在相当大的E序上决定着一个h的h生h(hun)值的实现E序。h的能力具有篏U效应,能够通过学习(fn)、锻D得到强化。需要有量变的积累,变做准备?
      • 立于现实,坚守岗位作A(ch)献;
      • 实现人生价D有自Z息的_?#8220;天行健,君子以自Z息?#8221;要实Ch生h(hun)|需要在实践中承和弘扬q种自强不息的精。畏惧劳苦,贪图安逸,坐n其成Q最l只能虚度年华,抱憾l生。只要始l保持自Z息的_状态,人生l会(x)有h(hun)倹{?/li>
    • 在实践中创造有价值的人生
      • C人民众相结合的道\Q?
      • CC会(x)实践相结合的道\Q艰辛知人生Q实践长才干。不仅要刻苦学习(fn)书本知识Q还要努力与C会(x)实践相结合,在社?x)实践中探求真知?/li>

三、科学对待h生环?/h3>
  • ?j)进自我w心(j)的和谐;
  • ?j)进个h与他人的和谐Q在处理个h与他人的关系Q关键是要处理好个h与他人的利益关系Q?
  • ?j)进个h与社?x)的和谐Q?
  • ?j)进Z自然的和谐;


eryar 2012-06-30 20:22 发表评论
]]> þѾDzݲƷ| ޹Ʒþþ| þۺϺݺۺϾþ| þ޸ۿ| ɫۺϾþ| þþƷҹҹҹҹҹþ| 칫ҾþþƷ| ŷۺϾþþ | ŷþþXXX| þþۺϾɫۺ98| ŷþþþ9999| þ99Ʒ| ԾþþӰԺ| ޺ݺۺϾþ| 뾫Ʒþþþ..| þþþƷר| þٸ۲AVר| Ʒþþþþ| þ㽶97Ʒ| ޹˾þһҳ| 99鶹þþùƷ| ھƷ˾þþӰԺ| AAƬѿƵþ| Ʒʾþþþ999Ұ| ŷҹAŴƬþ | þþþŮۺ| þþþavר| ޾Ʒһۺ99þ| þAAAAƬһ| Ʒþþþþ޾Ʒ| Ʒþþþþ| һŷƬþ | һƷþ| ŷղþ99| ޷?Vþò| 99þֻоƷ| 97þþƷһ| ޳ɫWWWþվ| ޹Ʒþþž| þeֻйľƷ99 | 97þþþ|