AutoCAD Civil 3D-部件编辑器(SAC)详解之一由多义线创建自定义部件

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/hjpqindong/article/details/96475495

创建部件的三种方法:

1、绘多义线,由多段线转换成部件;

2、使用部件编辑器SAC(图形编程);

3、使用编程调用API实现,功能强大,理论上可实现任何形状的横断面形式。

AutoCAD Civil 3D的所有部件都是用VB .NET调用API实现的。代码开源,如C3D 2016自带部件源代码在安装目录如下位置:

D:\Program Files\Autodesk\AutoCAD 2016\C3D\Sample\Civil 3D API\C3DStockSubassemblies\Subassemblies

由多义线创建部件

1、绘制多义线对象如线段、矩形

2、选择“由多段线创建部件”

3、输入部件名称

4、创建代码

选中创建的部件,在面板点击“添加代码”,选中部件中的线段,输入代码即可。

由多段线创建部件的做点是快捷,缺点是无法加入逻辑判断创建更复杂的自定义部件。

创建复杂的部件将在部件编辑器中进行。

展开阅读全文

designer无法加载自定义部件

11-29

第一次尝试编写一个继承于QLineEdit的自定义部件,实现一些其他的功能,能编译通过并在designer的插件文件夹生成so文件,但是designer中无法加载,网上的帖子千篇一律的都是转载的C++ Qt那本书上第五章的内容,不知道问题出在哪,高手帮忙看看rnrnpro文件rn[code=C/C++]TEMPLATE = librnCONFIG += designer plugin releasernHEADERS += myeditplugin.h \rn myedit.hrnSOURCES += myeditplugin.cpp \rn myedit.cpprnDESTDIR = $$[QT_INSTALL_PLUGINS]/designerrnTARGET = myEdit[/code]rnrn插件的头文件myeditplugin.hrn[code=C/C++]#ifndef MYEDITPLUGIN_Hrn#define MYEDITPLUGIN_Hrnrn#include rnrnclass MyEditPlugin : public QObject,rn public QDesignerCustomWidgetInterfacernrn Q_OBJECTrn Q_INTERFACES(QDesignerCustomWidgetInterface)rnpublic:rn MyEditPlugin(QObject *parent=0);rn QString name() const;rn QString includeFile() const;rn QString group() const;rn QIcon icon() const;rn QString toolTip() const;rn QString whatsThis() const;rn bool isContainer() const;rn QWidget *createWidget(QWidget *parent);rn;rnrn#endif // MYEDITPLUGIN_H[/code]rnrn插件的实现文件myeditplugin.cpprn[code=C/C++]#include "myeditplugin.h"rn#include "myedit.h"rnrn#include rn#define ICON_PATH "/opt/QtDesktop/image/qt_myEditPlugin/"rnrnMyEditPlugin::MyEditPlugin(QObject *parent)rn :QObject(parent)rnrnrnrnQString MyEditPlugin::name() constrnrn return "myEdit";rnrnrnQString MyEditPlugin::includeFile() constrnrn return "myedit.h";rnrnrnQString MyEditPlugin::group() constrnrn return tr("My Widgets");rnrnrnQIcon MyEditPlugin::icon() constrnrn return QIcon(ICON_PATH + QString("myEditPluginIcon.png"));rnrnrnQString MyEditPlugin::toolTip() constrnrn return tr("Can use systemkeyboard");rnrnrnQString MyEditPlugin::whatsThis() constrnrn return tr("");rnrnrnbool MyEditPlugin::isContainer() constrnrn return false;rnrnrnQWidget *MyEditPlugin::createWidget(QWidget *parent)rnrn return new MyEdit(parent);rnrnrnQ_EXPORT_PLUGIN2(myEditPlugin,MyEditPlugin)[/code]rnrn我自定义的继承于QLineEdit的头文件myedit.hrn[code=C/C++]#ifndef MYEDITPLUGIN_Hrn#define MYEDITPLUGIN_Hrnrn#include rnrnclass MyEditPlugin : public QObject,rn public QDesignerCustomWidgetInterfacernrn Q_OBJECTrn Q_INTERFACES(QDesignerCustomWidgetInterface)rnpublic:rn MyEditPlugin(QObject *parent=0);rn QString name() const;rn QString includeFile() const;rn QString group() const;rn QIcon icon() const;rn QString toolTip() const;rn QString whatsThis() const;rn bool isContainer() const;rn QWidget *createWidget(QWidget *parent);rn;rnrn#endif // MYEDITPLUGIN_H[/code]rnrn实现文件myedit.cpp应该不是问出问题的地方,在别的程序中已经测试通过了,就不贴出来了rnqmake make过后生成了so文件rn[code=C/C++]mv -f libmyEdit.so /usr/local/Trolltech/QtEmbedded-4.4.3/plugins/designer/[/code]rn但就是无法加载,第一次闹这东西,实在是找不到问题出在哪了,高手指点啊rn[img=https://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/3.gif][/img] 论坛

自定义webpart部件问题

12-01

小弟自定义一个webpart,用来读取列表数据并绑定到gridview上,一直通不过去,页面提示:值不在预期的范围内。rn不清楚到底错在哪了,请各位指导下,谢谢了。rnrn[code=C#]rnusing System;rnusing System.Collections.Generic;rnusing System.ComponentModel;rnusing System.Text;rnusing System.Web;rnusing System.Web.UI;rnusing System.Web.UI.WebControls;rnusing Microsoft.SharePoint.WebPartPages;rnusing Microsoft.SharePoint;rnusing System.Data;rnusing System.Xml.Serialization;rnnamespace MyWebPartrnrnrn [XmlRoot(Namespace = "MyWebPart")] rn [DefaultProperty("Text")]rn [ToolboxData("<0:WebPartTest runat=server>")]rn rnrn public class WebPartTest : WebPartrn rn [Bindable(true)]rn [Category("Appearance")]rn [DefaultValue("")]rn [Localizable(true)]rnrnrn protected Label label;rn protected GridView gridview;rnrnrn public string Textrn rn getrn rn String s = (String)ViewState["Text"];rn return ((s == null) ? "[" + this.ID + "]" : s);rn rnrn setrn rn ViewState["Text"] = value;rn rn rn protected override void RenderWebPart(HtmlTextWriter output)rn rn //base.RenderWebPart(output);rn RenderChildren(output);rn rn protected override void CreateChildControls()rn rn //base.CreateChildControls();rnrn label = new Label();rn label.Text = "This is a webpart test...";rnrn Controls.Add(label);rnrn gridview = new GridView();rn gridview.Load += new EventHandler(GridViewLoad);rnrnrn gridview.AutoGenerateColumns = true;rnrn Controls.Add(gridview);rnrn rn public void GridViewLoad(object sender, EventArgs e)rn rn BindGridView();rn rnrn private void BindGridView()rn rn using (SPWeb web = SPContext.Current.Web)rn rn SPList list = web.Lists["列表001"];rn if (list != null)rn rn SPQuery spquery = new SPQuery();rn gridview.DataSource = list.GetItems(spquery).GetDataTable();rn gridview.DataBind();rnrn rn elsern rnrn // label.Text = "no list....";rn rnrn rnrn throw new NotImplementedException();rn rnrn rnrnrnrn[/code] 论坛

没有更多推荐了,返回首页