muck Posted January 11, 2009 Posted January 11, 2009 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, Quote
ASMI Posted January 11, 2009 Posted January 11, 2009 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 Quote
muck Posted January 11, 2009 Author Posted January 11, 2009 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, Quote
Lee Mac Posted January 11, 2009 Posted January 11, 2009 As ASMI has mentioned in his post - the VBA alternative requires tons of codeing, why not use the simpler LISP method? Quote
muck Posted January 11, 2009 Author Posted January 11, 2009 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, Quote
muck Posted January 12, 2009 Author Posted January 12, 2009 What about using Sendcommand to make a new dimstyle then change that newly created dimstyle with other variables? Would that work? Quote
muck Posted January 12, 2009 Author Posted January 12, 2009 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. Quote
Recommended Posts
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.