Jump to content

Automated number insert and increment*noob*


bograd

Recommended Posts

I am a noob regarding AutoLisp.

 

What i want to do is this : I have drawing where i need to number many blocks. So i use DTEXT and place it near each block and type the number.

 

Is there a way to automate this procedure ? I want to start a command, place the point of insert for the first block, type the first number, and then just point the next block and it should increment the previous number and place it.

 

Does this make any sense ?

Link to comment
Share on other sites

Awesome, works like a charm. Thanks ASMI.

 

Now to be very picky, is there a way to auto number using DTEXT instead of attributed blocks ?

Link to comment
Share on other sites

  • 10 months later...

Hi,

 

Here is a small code in vba. I think it may help you.

 

Public num As Integer

Private Sub AcadDocument_BeginCommand(ByVal CommandName As String)

If CommandName = "DTEXT" Then

If num = 0 Then

num = InputBox("Please Enter Starting number")

End If

Dim txt As AcadText

Dim po As Variant

po = ThisDrawing.Utility.GetPoint(, "Select Insertion point")

Set txt = ThisDrawing.ModelSpace.AddText(CStr(num), po, 1)

num = num + 1

End If

End Sub

 

 

This will generate the increment number while continuos use of DTEXT command. After using of any other command you have to set the starting number.

 

Have a good day...

KUMAR.....:)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...