Jump to content

Creating a new dimstyle with Annotation dim's in VBA?


Recommended Posts

Posted

Creating a new dimstyle with Annotation dim's in VBA

Versioon 2009, VBA

 

Is there a way to create a new dimstyle with annotative dimension

in AutoCAD VBA? I think the dimanno variable will have to be 1 but

it is a read only variable. The Dimscale variable might have to be 0.

 

I have posted several simular threads on this dimstyle topic but

I am finding very little info on this topic form my internet searches.

 

 

Thank you,

 

 

 

 

 

Thank you,

Posted

I can to create annotative dimensions with lisp. I think possible also in VBA but it not easy task because annotation data contains in "ACDB_ANNOTATIONSCALES" extension dictionary. It is loooooooooooooong code to fill this dictionaries by data with VBA. I do not want to do it, but I think that in principle it is possible. You can get and explore all members of this dictionary with lisp function like this:

 

(defun Get_Annotation_Dictionary(vlaObj / aDic)
 (if(= :vlax-true
     (vla-get-HasExtensionDictionary vlaObj))
   (progn
     (vlax-for d(vla-GetExtensionDictionary vlaObj)
      (if(and
   (vlax-property-available-p d 'Name)
   (= "ACDB_ANNOTATIONSCALES"(vla-get-Name d))
   ); end and
 (setq aDic d)
); end if
      ); end vlax-for
     ); end progn
   ); end if
aDic
 ); end of Get_Annotation_Dictionary

Posted

Maybe someone who knows how to do this in VBA might reply to this post.

 

I have found very little in my internet searches.

 

Thank you,

Posted

As ASMI has mentioned in his post - the VBA alternative requires tons of codeing, why not use the simpler LISP method?

Posted

I guess we have to go with what works.

 

I guess I should use Set objDimStyle = ThisDrawing.DimStyles.Add("stNa")

to start with and call up the above rountine aftwards?

 

How would VBA be use to call up the above lisp routine for this. Does anyone

have a sample of using VBA - lisp routine to change annotation dim scale

 

Thank you,

Posted

What about using Sendcommand to make a new dimstyle then

change that newly created dimstyle with other variables?

 

Would that work?

Posted

Maybe something like this but I am going to have to figure out how to

give my new dimstyle a unque name for every time I hit the event button.

Any suggestions, I am still trying?

 

Private Sub CommandButton5_Click()

'UserForm1.hide

'ThisDrawing.SendCommand "Dimscale" & vbCr

'ThisDrawing.SendCommand "0" & vbCr

'ThisDrawing.SendCommand "*" & vbCr

Dim X As Integer

X = 5

X = X + 1

Dim DimStyName As String

DimStyName = "DimstyleName"

DimStyName = DimStyName & Str(X)

ThisDrawing.SendCommand "-dimstyle" & vbCr & "AN" & vbCr & "Y" & vbCr & DimStyName & vbCr & "S" & vbCr & vbCr

End Sub

 

Maybe I can change a current dimstyle to annotative dim. Any suggestions.

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...