目标:选择一个标注,然后弹出窗口,添加公差等。
Public pickedobj As AcadEntity
If Not IsNull(ThisDrawing.SelectionSets.Item("sss")) Then Set sset = ThisDrawing.SelectionSets.Item("sss") sset.Delete End If Set sset = ThisDrawing.SelectionSets.Add("sss") sset.SelectOnScreen
If sset.Count > 1 Then MsgBox "老大,您选的太多了!" UserForm1.Hide Exit Sub End If
For Each pickedobj In sset //第一个问题:选择里就一个,我不想循环就得到,咋弄涅 txtBase.Text = pickedobj.Measurement Next
---------------------------------
For Each pickedobj In sset pickedobj.TextOverride = comBefore.Text & Left(txtBase.Text, 4)
If txtDown.Text <> "" Or txtUp.Text <> "" Then pickedobj.ToleranceDisplay = acTolDeviation pickedobj.TolerancePrecision = acDimPrecisionFour pickedobj.ToleranceHeightScale = 1 pickedobj.ToleranceLowerLimit = txtDown.Text pickedobj.ToleranceUpperLimit = txtUp.Text
End If pickedobj.Update Next
第二个问题:选择集里就是标注的话,pickedobj可以代表acadDimAligned吗?用它属性TextOverride可以显示出,但为啥标注后面没显示公差。
是不是要重新定义个dimAligned,让它等于pickedObj?用哪个方法?
试着弄了一天,没出来,大虾指点指点。 |