AutoCAD Civil 3D-部件编辑器(SAC)详解之自定义部件(行车道示例)

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

Civil 3D的部件编辑器“Subassembly Composer”(通常简称为SAC)是一个图形编程软件,可定制各种部件,如行车道、多级边坡、隧洞等。可在开始菜单的C3D安装文件夹里找到。其安装程序则一般位于“C:\Program Files (x86)\Autodesk\Subassembly Composer 2016”,软件名为“SubassemblyComposer.exe”。现在的高版本C3D已集成此工具,无需另外下载安装。

隧洞部件

今天我们以一个简单行车道部件的制作来了解各基本工具的使用方法。更复杂的部件工具将在以后进行介绍。

1、打开部件编辑器界面如下:

Civil 3D部件编辑器(SAC)界面

2、从“File”菜单下点击“New”(或直接用快捷键Ctrl+N)新建一个部件文件;
3、在“Packet Settings”里输入部件名、描述、设置帮助文件或显示图片:

4、在输入、输出参数表中输入参数:

参数表
参数名 类型
Side Side right
width Double 12
Depth Double 0.8
Slope Grade -3.0%

定义参数是参数化部件的必要步骤。在此定义的参数可在Civil 3D里的属性表中在装配部件时进行设置修改。

5、拖入一个Point,默认名为P1,因是起始点,不用作任何编辑;
6、再拖入一Point,名为P2,从P1出发,类型:Slope and Deltax、Slope中输入参数“Slope”(这是我们在前面输入/输出参数表中定义的参数名),DeltaX中输入定义的“Width”,可在右侧预览窗口动态查看效果;

7、创建P3点,P3在P1下面,选从P1出发,类型:DeltaX and DeltaY,DeltY设为“-Depth”(行车道厚度);

8、创建P4点,从P2出发,类型:DeltaX and DeltaY,DeltaY也设为“-Depth”

9、添加一个Link,连接P3、P4,设置如下:

10、创建一个Shape,通过点击“Add line”将四条连接加入Shape(点“Add Line后选中P4,再点击会自动添加L3、L2、L1”);

11、给Shape添加一个代码值“行车道”:

12、给L1添加代码“顶部”:

13、在预览窗口中选中“Codes”可显示代码值,制作的部件效果如下图:

13、完成部件创建保存退出,在C3D中导入后就可以使用了。

部件编辑器完成行车道部件创建

在C3D里导入:

装配时选中部件,我们在部件编辑器的输入/输出窗口中设定的参数将出现在属性列表框中:

在属性框将Side(在部件编辑器中的输入/输出参数表中定义了Side,所以可在这里进行设置)属性设为left,点击装配节点完成左侧部件装配。重复上一步将Side设为"right"完成右侧部件装配。完成后效果如下:

 

展开阅读全文

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] 论坛

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