SolidWorks机械工程师网——最大的SolidWorks学习平台

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

how to attach an existing annotation to a drawing view

[复制链接]

75

主题

317

帖子

159

金币

侠客

Rank: 3Rank: 3Rank: 3

积分
495
QQ
跳转到指定楼层
楼主
发表于 2014-2-28 20:55:32 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

   经典图书
This example shows how to attach an existing annotation to a drawing view.
//----------------------------------------------------------------------------
// Preconditions: Open install_dirsamplestutorialapireplaceview.slddrw.
//
// Postconditions:
// 1. A note annotation is inserted in the drawing.
// 2. The annotation is selected.
// 3. A face in a drawing view is appended to the selection list.
// 4. The annotation is attached to the selected face.
// ---------------------------------------------------------------------------
using SolidWorks.Interop.sldworks;
using SolidWorks.Interop.swconst;
using System.Runtime.InteropServices;
using System;
namespace AttachAnnotation_CSharp.csproj
{
partial class SolidWorksMacro
{
ModelDoc2 part;
DrawingDoc draw;
Note aNote;
Annotation anAnnot;
SelectData selectData = null;
int ret;
bool boolstatus;
public void Main()
{
part = (
ModelDoc2)swApp.ActiveDoc;
draw = (
DrawingDoc)part;
boolstatus = draw.ActivateSheet(
"Sheet1");
aNote = (
Note)draw.CreateText2("This is a note.", 0.21, 0.12, 0, 0.005, 0);
anAnnot = (
Annotation)aNote.GetAnnotation();
ret = anAnnot.SetLeader3(
swLeaderStyle_e.swBENT, swLeaderSide_e.swLS_SMART, true, false, false, false);
anAnnot.Select3(
false, selectData);
boolstatus = draw.ActivateView(
"Drawing View1");
boolstatus = part.Extension.SelectByID2(
"", "FACE", 0.0783563575357558, 0.17448024010205, -499.965138294658, true, 0, null, 0);
draw.AttachAnnotation(
swAttachAnnotationOption_e.swAttachAnnotationOption_View);
}
public SldWorks swApp;
}
}

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 转播转播 分享教程|习题|模型|技巧 点赞点赞7265 拍砖拍砖3945
SolidWorks机械工程师网
提示:建议使用谷歌浏览器浏览本网站!如单击这里下载!否则,可能无法下载附件文件!(支持大多数版本的谷歌浏览器,支持360和QQ浏览器的极速模式,即谷歌内核模式,使用IE和Edge浏览器,浏览个别网页以及下载文件时,会误报“***不安全”,此时需要单击“继续访问此不安全站点(不推荐)”才可以继续下载,另外,本网站不含任何不安全的文件,已联系微软公司解决,纯属IE和Edge浏览器误报)
回复

使用道具 举报

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

本版积分规则

SOLIDWORKS 2023 机械设计从入门到精通

手机版|小黑屋| GMT+8, 2025-7-16 21:21 , Processed in 0.541598 second(s), 26 queries , Memcache On.

SolidWorks机械工程师网 ( 鲁ICP备14025122号-2 ) 鲁公网安备 37028502190335号

声明:本网言论纯属发表者个人意见,与本网立场无关。
如涉版权,可发邮件: admin@swbbsc.com

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