Absntmind 发表于 2022-7-6 17:20:32

Copy Number + .01

I am coming across a situation at work (which will last for a period of time) where we are creating a numerical grid. I created the proto with a default grid, and the same number copied throughout (#1.11-0.00). The thing killing me is having to edit each one, one at a time. Can be time consuming when there are a few hundred. A while back, someone helped out with a match text lisp for a different situation, which is somewhat helpfull in this situation. Also one which will copy a number, then place the second below it adding .01 .I can match one row, then only edit one digit at a time for each sequence. Still takes a long time.
 
I was wondering if between the two, a lisp could be created to match the text then instead of replacing the text exactly, add .01 to the number. Such as if I have a row, I edit the first number, use a command, then select the first, and after, every number I select will go up .01 ( #123.11-0.00 , #123.12-0.00, #123.13-0.00, ect..). Or if it would just be easier to create a new one from scratch.
 
If anyone could point me in the right direction, or at least help me get started, it would be very much appretiated

CmdrDuh 发表于 2022-7-6 18:10:50

I have this as VBA if you want it

Public Sub TextNumber()   Dim objSelected As Object   Dim blnFlag As Boolean   Dim intCnt As Integer   Dim strValue As String   Dim objTxt As AcadText   Dim objSelSet As AcadSelectionSet   On Error GoTo ErrControl   Set objSelSet = ThisDrawing.SelectionSets.Add("Text")   objSelSet.SelectOnScreen   intCnt = 1   For Each objSelected In objSelSet         If TypeOf objSelected Is AcadText Then               Set objTxt = objSelected               If blnFlag = False Then      'This is the first entity selected                     objTxt.TextString = intCnt                     blnFlag = True               Else                     objTxt.TextString = intCnt               End If               intCnt = intCnt + 1         Else               MsgBox "Object number " & intCnt & " is not DText, you need to reselect", vbInformation, "Gap Set"               ThisDrawing.SelectionSets.Item("Text").Delete         End If   Next   ThisDrawing.SelectionSets.Item("Text").Delete   ThisDrawing.Application.UpdateExit_Here:   Exit SubErrControl:   MsgBox Err.DescriptionEnd Sub

ASMI 发表于 2022-7-6 18:39:43

This http://www.asmitools.com/Files/Lisps/Num.html or http://www.asmitools.com/Files/Lisps/Renum.html will ok.
页: [1]
查看完整版本: Copy Number + .01