乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 53|回复: 2

Civil 3D将块添加到点标签样式

[复制链接]

14

主题

36

帖子

3

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
92
发表于 2018-2-26 14:32:48 | 显示全部楼层 |阅读模式
我正在尝试将块组件添加到点标签样式中。 我还没有弄清楚如何在创建组件后分配块名称。 我唯一能找到的是组件。这是可能的,还是我错过了一些简单的东西?
  1.         Private Sub addBlockComponent(ByVal style As LabelStyle, ByRef blknam As String, blkht As Double)
  2.             Dim id As ObjectId = style.AddComponent("Block", LabelStyleComponentType.Block)
  3.             Dim component As LabelStyleBlockComponent = TryCast(id.GetObject(OpenMode.ForWrite), LabelStyleBlockComponent)
  4.             component.Block.BlockName.Value = blknam
  5.             component.Block.Attachment.Value = BlockAttachmentType.MiddleCenter
  6.             component.Block.BlockHeight.Value = blkht
  7.             component.Block.RotationAngle.Value = 0
  8.         End Sub

本帖以下内容被隐藏保护;需要你回复后,才能看到!

游客,如果您要查看本帖隐藏内容请回复
回复

使用道具 举报

71

主题

928

帖子

8

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1230
发表于 2018-2-26 17:53:02 | 显示全部楼层
在 C3D 2018 中,BlockName.Value 属性为 get/set,因此您可以分配要使用的块。但是,高度和旋转值仅获取。我发现文档上写满了 Block 的所有内容,属性仅获取,但 BlockName、Attachment、XOffset 和 YOffset 都是 get/set。以下 c# 代码适用于我: [CommandMethod(“testsetting”)]。
公共 void testsetting()。
{。
CivilDocument civdoc = (CivilDocument)CivilApplication.ActiveDocument;。
using (AcDb.Transaction tr = AcDb.HostApplicationServices.WorkingDatabase.TransactionManager.StartTransaction())。
{。
LabelStyle labelStyle = (LabelStyle)tr.GetObject(civdoc.Styles.LabelStyles.PointLabelStyles.LabelStyles[0], AcDb.OpenMode.ForWrite);。
var compId = labelStyle.AddComponent(“TheBlock”, labelStyleComponentType.Block);。
var comp = (LabelStyleBlockComponent)tr.GetObject(compId, AcDb.OpenMode.ForWrite);。
比较Block.BlockName.Value = “bound”;必须存在于图形中。
比较Block.Attachment.Value = Autodesk.Civil.BlockAttachmentType.MiddleCenter;。
比较Block.XOffset.Value = (.1/12);。
比较Block.YOffset.Value = (.1/12);。
断续器Commit();。
}。
}。

回复

使用道具 举报

14

主题

36

帖子

3

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
92
发表于 2018-2-27 11:46:49 | 显示全部楼层
谢谢你杰夫!
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-2-4 10:36 , Processed in 0.144879 second(s), 58 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表