乐筑天下

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

[编程交流] Dim Style overrides & changing

[复制链接]

170

主题

347

帖子

174

银币

中流砥柱

Rank: 25

铜币
870
发表于 2022-7-6 17:05:41 | 显示全部楼层 |阅读模式
AutoCAD VBA
 
In AutoCAD 2004 I use the following code to change my
dimstyle variables by picking the dimension.
 
In AutoCAD 2009 the following code does not do this.
I think is changes dim style overrides? What ever that
is?
 
I would like to simply change my dim variables in current
dim style. How can the following code be modified to do
this?
 
Private Sub CommandButton2_Click()
Dim objDimension As AcadDimension
Dim varPickedPoint As Variant
Dim objDimStyle As AcadDimStyle
Dim strDimStyles As String
Dim strChosenDimStyle As String
Dim stg As String
On Error Resume Next
   Me.hide
    ThisDrawing.Utility.GetEntity objDimension, varPickedPoint, _
        "Picked a dimension whose style you wish to set"
    If objDimension Is Nothing Then
    MsgBox "You failed to pick a dimension object"
    Exit Sub
    End If
    stg = "Textheight"
 
    MsgBox objDimension.VerticalTextPosition
    'DIMTAD
    ThisDrawing.SetVariable "DIMTAD", objDimension.VerticalTextPosition
 
    MsgBox objDimension.TextHeight
    ThisDrawing.SetVariable "DIMTX", objDimension.TextHeight
 
    MsgBox objDimension.TextStyle
 
    MsgBox objDimension.TextGap
    ThisDrawing.SetVariable "DIMJUST", objDimension.TextGap
 
    MsgBox objDimension.ArrowheadSize
    ThisDrawing.SetVariable "DIMASZ", objDimension.ArrowheadSize
 
    MsgBox objDimension.ExtensionLineExtend
 
    MsgBox objDimension.ExtensionLineOffset
 
End Sub
 
Thank you,
回复

使用道具 举报

0

主题

252

帖子

290

银币

限制会员

铜币
-8
发表于 2022-7-6 17:21:56 | 显示全部楼层
You want to grab the current style, and make all your changes, then update the style by reading the values.  I'll post example BRB
回复

使用道具 举报

0

主题

252

帖子

290

银币

限制会员

铜币
-8
发表于 2022-7-6 17:49:25 | 显示全部楼层
  1.      Set objDimStyle = ThisDrawing.DimStyles.Add("YourNamedStyle")     objDimStyle.CopyFrom ThisDrawing     ThisDrawing.ActiveDimStyle = objDimStyleMake your changes here....................     objDimStyle.CopyFrom ThisDrawing
回复

使用道具 举报

170

主题

347

帖子

174

银币

中流砥柱

Rank: 25

铜币
870
发表于 2022-7-6 17:56:55 | 显示全部楼层
How do I get the Annotative text variable and the Dimstyle variable???
 
I think that is what I need to make this thing work??
Thank you,
回复

使用道具 举报

0

主题

252

帖子

290

银币

限制会员

铜币
-8
发表于 2022-7-6 18:19:39 | 显示全部楼层
If your looking for a variable to make a style annotative, that is the one thing I have not been able to do.  What do you mean by dimstyle var?  That seems to open the dim manager
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-4 20:17 , Processed in 0.690471 second(s), 62 queries .

© 2020-2025 乐筑天下

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