Compline error in hidden module : ModcadFunction

Compline error in hidden module : ModcadFunction

Gaganpatel
Collaborator Collaborator
2,650 Views
24 Replies
Message 1 of 25

Compline error in hidden module : ModcadFunction

Gaganpatel
Collaborator
Collaborator

Dear Sir,

 

Please see the attached error massage used autocad 2020 64bit & help me.

 

Option Explicit

Dim BNSize(1 To 100) As String
Dim BNQty(1 To 100) As Integer
Dim SS As AcadSelectionSet

'Count BN from layers BN1,BN2,BN4
Sub BNCount()

Dim BoltSize As String
Dim BoltQty As Integer
Dim LayerQty As Integer
Dim Boltstr As Variant 'as Variant because split function return array

SelectBN
If SS.Count = 0 Then
MsgBox "No Valid Bolt Nut Block selected"
Exit Sub
End If

Call FillArray(BNSize, "") 'LIB sub
Call FillArray(BNQty, 0) 'LIB sub

Dim BNBLOCK As Variant
Dim BNAtt As Variant
Dim Count As Integer

Dim Donut As AcadLWPolyline
Dim VarDIMSCALE
Dim Errfound As Boolean
VarDIMSCALE = ThisDrawing.GetVariable("DIMSCALE")
Errfound = False

If findlayer("TEMP") = False Then
ThisDrawing.Layers.Add "TEMP"
End If

For Each BNBLOCK In SS

LayerQty = Val(Right(BNBLOCK.Layer, 1))

If BNBLOCK.HasAttributes Then
BNAtt = BNBLOCK.GetAttributes
For Count = LBound(BNAtt) To UBound(BNAtt)
If InStr(BNAtt(Count).TextString, "-") > 0 Then ' if - found in att then
Boltstr = Split(BNAtt(Count).TextString, "-")
BoltQty = Val(Boltstr(0))

If BoltQty = 0 Then ' if qty = 0 or any non numeric string then
Set Donut = AddDonut(ThisDrawing.ModelSpace, VarDIMSCALE * 5#, VarDIMSCALE * 10#, BNBLOCK.InsertionPoint)
Donut.Color = acMagenta
Donut.Layer = "TEMP"
Errfound = True
Else
BoltSize = Boltstr(1)
AddTOBNSum BoltSize, BoltQty * LayerQty
End If


Else

Set Donut = AddDonut(ThisDrawing.ModelSpace, VarDIMSCALE * 5#, VarDIMSCALE * 10#, BNBLOCK.InsertionPoint)
Donut.Color = acMagenta
Donut.Layer = "TEMP"
Errfound = True
End If

Next Count
End If

Next BNBLOCK

If Errfound Then
MsgBox "Error found , Atrribute without - or Qty not valid number "
Else
Call WriteBNSum
End If

SS.Clear
Set SS = Nothing

End Sub

Private Sub SelectBN()

Dim FType
Dim FData
BuildFilter FType, FData, 2, "B1,B2,B3,B4,B5,B6,B7,B8,B9,B10", 8, "BN1,BN2,BN3,BN4"
On Error Resume Next
Set SS = ThisDrawing.SelectionSets("SS")
If Err Then Set SS = ThisDrawing.SelectionSets.Add("SS")
SS.Clear
SS.SelectOnScreen FType, FData

End Sub

Private Sub AddTOBNSum(BoltSize, BoltQty)
Dim I As Integer
For I = 1 To 100
If BNSize(I) = BoltSize Then
BNQty(I) = BNQty(I) + BoltQty
Exit Sub
End If
Next

For I = 1 To 100
If BNSize(I) = "" Then
BNSize(I) = BoltSize
BNQty(I) = BoltQty
Exit Sub
End If
Next

End Sub

Private Sub WriteBNSum()

Dim pnt As Variant

Dim ExtraPer As Double
Dim AddNo As Integer
Dim Textheight As Integer
Dim Vspacing As Integer
Dim Hspacing As Integer
Dim VarDIMSCALE



pnt = ThisDrawing.Utility.GetPoint(, vbCr & "Select Insertion point : ")
VarDIMSCALE = ThisDrawing.GetVariable("DIMSCALE")

ExtraPer = GetRel("Extra % of Bolt Nut", 0, 4) 'LIB Function (4 not allow -Ve)
AddNo = GetInt("Additional No of Bolt nut", 0, 4) 'LIB Function

Textheight = VarDIMSCALE * GetInt("Text Height", 3, 6) 'LIB Function
Vspacing = Textheight + VarDIMSCALE * GetInt("Vertical spacing", 3, 6) 'LIB Function (6 not allow 0 & -Ve)
Hspacing = VarDIMSCALE * GetInt("Horigontal spacing", 40, 6) 'LIB Function

If findlayer("TEXT") = False Then
MsgBox "Text layer not found , Creating text layer"
ThisDrawing.Layers.Add "TEXT"
End If

Call WriteStringArray(BNSize, pnt, Textheight, Vspacing, "TEXT") 'LIB SUB

'Inc BN qty based on extra % or add no
Dim BNper As Integer
Dim BNadd As Integer
Dim I As Integer

For I = 1 To 100
If BNQty(I) = 0 Then Exit For
BNper = Int(round((BNQty(I) * (100# + ExtraPer) / 100#), 0))
BNadd = BNQty(I) + AddNo

If BNper > BNadd Then
BNQty(I) = BNper
Else
BNQty(I) = BNadd
End If

Next


Dim X As Double
Dim Y As Double
Dim Z As Double

X = pnt(0) + Hspacing
Y = pnt(1)
Z = pnt(2)

pnt = point3d(X, Y, Z) 'LIB FUNCTION
Call WriteNumberArray(BNQty, pnt, Textheight, Vspacing, "TEXT") 'LIB SUB

End Sub

*Moderator edit* Please post code to a code window.

0 Likes
Accepted solutions (1)
2,651 Views
24 Replies
Replies (24)
Message 2 of 25

Gaganpatel
Collaborator
Collaborator

Dear Sir,

 

Any body please help me.

0 Likes
Message 3 of 25

Ed__Jobe
Mentor
Mentor

Instead of trying to run the code, open it in the VBA IDE. Click on Debug>Compile and the compiler will break on the line that has the problem.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 4 of 25

Gaganpatel
Collaborator
Collaborator

Dear Sir,

I have trying but problem not solved.

Please help me solve my problem.

Code is available on previous post.

0 Likes
Message 5 of 25

Ed__Jobe
Mentor
Mentor

I know you've been trying, but did you try Debug>Compile?

acad vba compile.png

Also, you didn't post all your code. There are functions called that are missing. If you want us to find the "hidden module", you need to post your whole dvb. Zip it first.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 6 of 25

Gaganpatel
Collaborator
Collaborator

 

Dear Sir,

 

Please find the attached DVB file & Please help .

0 Likes
Message 7 of 25

Ed__Jobe
Mentor
Mentor

They are all missing references. Are you missing any references on your pc.

missing 1.png

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 8 of 25

Gaganpatel
Collaborator
Collaborator

Dear Sir,

 

Please solve my problem.

Gaganpatel_0-1713806896547.png

 

0 Likes
Message 9 of 25

Ed__Jobe
Mentor
Mentor

I can't if you don't answer my questions. See posts 5 and 7. If you don't understand English well enough, then use Microsoft Translator.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 10 of 25

Gaganpatel
Collaborator
Collaborator

Dear Sir,

 

All reference file are active.

Please see the attached image.

 

active reference file .jpg

0 Likes
Message 11 of 25

Ed__Jobe
Mentor
Mentor

Getting information out of you sure isn't easy. Can you be more thorough? You didn't answer the question in post 5? Did you try to compile? Also, you never posted Nitin Cad Library.dvb.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 12 of 25

Gaganpatel
Collaborator
Collaborator

Dear Sir,

 

Please find the attached Nitin_CAD.dvb

0 Likes
Message 13 of 25

Ed__Jobe
Mentor
Mentor

First tell me if you tried compiling?

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 14 of 25

Gaganpatel
Collaborator
Collaborator

Dear Sir,

 

Yes i have tried .

I don't VBA programming.

I request you please help me.

0 Likes
Message 15 of 25

Ed__Jobe
Mentor
Mentor

The dvb you uploaded is password protected. You need to remove the password protection and upload it again.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 16 of 25

Gaganpatel
Collaborator
Collaborator

Dear Sir,

 

Please find the attached password removed .dvb file.

0 Likes
Message 17 of 25

Ed__Jobe
Mentor
Mentor

Please post a zip, not rar.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 18 of 25

Gaganpatel
Collaborator
Collaborator

Dear Sir,

 

Please find the attached .dvb file

0 Likes
Message 19 of 25

Ed__Jobe
Mentor
Mentor
Accepted solution

Replace your BoltCount.dvb with this one. I removed the reference to Nitin_CAD_Library and imported the modules into it. That dvb was corrupted and was not updated for 64 bit. You will have to add the reference to DAO again. I do not have that tlb. I don't use DAO anymore.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 20 of 25

Gaganpatel
Collaborator
Collaborator

Dear Sir,

 

Many Many Thanks , Working good

15 Nos. file are same problem how to solve problem. Please help me.

 

0 Likes