Home > Software engineering >  Automatic assignment code? 100 start increasing??????
Automatic assignment code? 100 start increasing??????

Time:10-21

 Private Function getSouthBM (ByRef aEnt As AcadEntity) As String 
On Error GoTo EH
GetSouthBM=getSouthX (aEnt)
EH:
GetSouthCodeBM 'Debug. Print "errors in the module, the error description for:" & amp; Err. The Description
End the Function


Private Function getSouthX (ByRef aEnt As AcadEntity, Optional independence idx As Integer=1) As String
On Error GoTo EH

Dim xdataOut As the Variant
Dim xtypeOut As the Variant
Dim groupCode As the Variant, dataCode As the Variant
AEnt. GetXData "SOUTH", xtypeOut xdataOut
If IsEmpty (xtypeOut) Then
GetSouthX=""
The Else
GetSouthX=CStr (xdataOut (independence idx))
End the If
The Exit Function
EH:

End the Function
Private Sub setSouthX (ByRef aEnt As AcadEntity, ByRef sVal As String, Optional independence idx As Integer=1)
On Error GoTo EH

Dim xdataOut As the Variant
Dim xtypeOut As the Variant
Dim groupCode As the Variant, dataCode As the Variant
AEnt. GetXData "SOUTH", xtypeOut xdataOut
XdataOut (independence idx=sVal)
AEnt. SetXData xtypeOut, xdataOut


The Exit Sub
EH:

End Sub





Private Function getSouthZDH (ByRef aEnt As AcadEntity) As String
On Error GoTo EH
GetSouthZDH=getSouthX (aEnt, 2)
EH:

End the Function
Private Function getSouthQLR (ByRef aEnt As AcadEntity) As String
On Error GoTo EH
GetSouthQLR=getSouthX (aEnt, 3)
EH:

End the Function

Private Function getSouthDLH (ByRef aEnt As AcadEntity) As String
On Error GoTo EH
GetSouthDLH=getSouthX (aEnt, 4)
EH:

End the Function

Private Sub BatchModify (independence idx As Integer)
'independence idx=2 # modify a ground independence idx=3 modifies the obligee independence idx=4 class
On the Error Resume Next
Dim aEnt As AcadEntity
Dim sOld As String
Dim sNew As String
'<1> Prefixing & lt; 2> Add the suffix & lt; 3> Character to replace
Dim sPstr As prefix String '
Dim sEstr As String 'suffix
Dim sFind, sReplace As String
Dim the sOp As String

SFind=""
SReplace=""
SPstr=""
SEstr=""

SOp=ThisDrawing. Utility. Get string (False, "& lt; 1> Prefixing & lt; 2> Add the suffix & lt; 3> Character to replace & lt; 4 & gt; The prefix automatic assignment ")

The Select Case CInt (sOp)
Case 1
SPstr=ThisDrawing. Utility. Get string (False, "input prefix:" + vbCrLf)
Case 2
SEstr=ThisDrawing. Utility. Get string (False, vbCrLf & amp; "Input suffix:" + vbCrLf)
Case 3
SFind=ThisDrawing. Utility. Get string (False, vbCrLf & amp; "Please enter the characters find:" + vbCrLf)
SReplace=ThisDrawing. Utility. Get string (True, vbCrLf & amp; "Please enter the characters replaced:" + vbCrLf)
Case 4

Automatic assignment code? 100 start increasing????????????

???????????????????????????????????

In Case the Else
End the Select


For Each aEnt ThisDrawing In. ModelSpace
If getSouthBM (aEnt)="300000" Then 'ownership line
SOld=getSouthX (aEnt, independence idx)

If sReplace="" Then sReplace=" "
SNew=sPstr & amp; The Replace (sOld, sFind sRepalce) & amp; SEstr
SetSouthX aEnt sNew, independence idx

End the If
Next


End Sub

Public Sub modifyDJH ()
BatchModify (2)
End Sub

Public Sub modifyQLR ()
BatchModify (3)
End Sub
Public Sub modifyDLH ()
BatchModify (4)
End Sub


Everybody is good, change the properties of CAD in this way, please, how to modify this code automatic assignment? Thank you very much!

CodePudding user response:

 Private Function getSouthBM (ByRef aEnt As AcadEntity) As String 
On Error GoTo EH
GetSouthBM=getSouthX (aEnt)
EH:
GetSouthCodeBM 'Debug. Print "errors in the module, the error description for:" & amp; Err. The Description
End the Function


Private Function getSouthX (ByRef aEnt As AcadEntity, Optional independence idx As Integer=1) As String
On Error GoTo EH

Dim xdataOut As the Variant
Dim xtypeOut As the Variant
Dim groupCode As the Variant, dataCode As the Variant
AEnt. GetXData "SOUTH", xtypeOut xdataOut
If IsEmpty (xtypeOut) Then
GetSouthX=""
The Else
GetSouthX=CStr (xdataOut (independence idx))
End the If
The Exit Function
EH:

End the Function
Private Sub setSouthX (ByRef aEnt As AcadEntity, ByRef sVal As String, Optional independence idx As Integer=1)
On Error GoTo EH

Dim xdataOut As the Variant
Dim xtypeOut As the Variant
Dim groupCode As the Variant, dataCode As the Variant
AEnt. GetXData "SOUTH", xtypeOut xdataOut
XdataOut (independence idx=sVal)
AEnt. SetXData xtypeOut, xdataOut


The Exit Sub
EH:

End Sub





Private Function getSouthZDH (ByRef aEnt As AcadEntity) As String
On Error GoTo EH
GetSouthZDH=getSouthX (aEnt, 2)
EH:

End the Function
Private Function getSouthQLR (ByRef aEnt As AcadEntity) As String
On Error GoTo EH
GetSouthQLR=getSouthX (aEnt, 3)
EH:

End the Function

Private Function getSouthDLH (ByRef aEnt As AcadEntity) As String
On Error GoTo EH
GetSouthDLH=getSouthX (aEnt, 4)
EH:

End the Function

Private Sub BatchModify (independence idx As Integer)
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  •  Tags:  
  • VBA
  • Related