Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 10
» Latest member: IrishH6065
» Forum threads: 4
» Forum posts: 4

Full Statistics

Online Users
There are currently 6 online users.
» 0 Member(s) | 5 Guest(s)
Bing

Latest Threads
Round UP Function in Exce...
Forum: Excel VBA
Last Post: CAA
08-01-2019, 09:58 AM
» Replies: 0
» Views: 137
HOW to Record a Solidwork...
Forum: Solidworks VBA
Last Post: CAA
07-27-2019, 09:37 AM
» Replies: 0
» Views: 74
Simple AutoCAD VBA code t...
Forum: AutoCAD VBA
Last Post: CAA
07-25-2019, 07:09 AM
» Replies: 0
» Views: 1,393
How to insert external dr...
Forum: AutoCAD VBA
Last Post: CAA
07-25-2019, 07:05 AM
» Replies: 0
» Views: 539

 
  Round UP Function in Excel VBA
Posted by: CAA - 08-01-2019, 09:58 AM - Forum: Excel VBA - No Replies

Example round up function for excel vba

Function RoundUp(ByVal Value As Double)
    If Int(Value) = Value Then
        RoundUp = Value
    Else
        RoundUp = Int(Value) + 1
    End If
End Function


'call statements
sideholes = RoundUp(VARIABLE)

Print this item

  HOW to Record a Solidworks macro
Posted by: CAA - 07-27-2019, 09:37 AM - Forum: Solidworks VBA - No Replies

In this example we will discuss about “How to Record a Macro in Solidworks”

Once you open the Solidworks, Go to Tools -> Macro -> Record

1.    
Then start your project, in this example we will be making a cylinder (Draw circle and extrude it to Cylinder)

Create a New Part Document
2.    

Then Create a Circle and Extrude it.
3.    

After creating the Cylinder, Go to Tools -> Macro-> Stop and save your Macro
4.    

After saving the macro, close the part document (without saving it)
5.    

Now, you have created your macro for creating a cylinder. (Dimensioning will be discussed in next post)



In order to use the macro, go to Tools->Macro->Run

6.    
And open the newly created macro
7.    
As you can see that your Part Document is automatically generated
8.    

Print this item

  Simple AutoCAD VBA code to draw circle
Posted by: CAA - 07-25-2019, 07:09 AM - Forum: AutoCAD VBA - No Replies

Function drawcircle(ByVal x1c As Double, ByVal y1c As Double, ByVal r1c As Double, ByVal cc As Integer)
Dim Centerpoint(0 To 2) As Double

Dim CirObj As AcadCircle
  'Start Coordinates Coordinates XYZ
Centerpoint(0) = x1c: Centerpoint(1) = y1c: Centerpoint(2) = 0
'End Coordinates Coordinates XYZ

'Line object in to drawing space

Set CirObj = ThisDrawing.ModelSpace.AddCircle(Centerpoint(), r1c)

Select Case cc

Case 1
CirObj.color = acWhite
CirObj.Update

Case 2
CirObj.color = acCyan
CirObj.Update

Case 3
CirObj.color = acGreen
CirObj.Update

Case 4
CirObj.color = acRed
CirObj.Update

Case 5
CirObj.color = acYellow
CirObj.Update

Case 6
CirObj.color = acBlue
CirObj.Update

Case 7
CirObj.color = acMagenta
CirObj.Update

Case Else
'LinObj.color = acWhite
CirObj.Update
End Select

End Function

Print this item

  How to insert external drawing as block using AutoCAD VBA
Posted by: CAA - 07-25-2019, 07:05 AM - Forum: AutoCAD VBA - No Replies

use below code to insert a different drawing file as block inside a cad drawing - using AutoCAD VBA

Sub CAAinsertblock()
  Dim FileToInsert As String
  Dim BlockRef14 As AcadBlockReference
  Dim insertionPnt4(0 To 2) As Double
  insertionPnt4(0) = DRGX#: insertionPnt4(1) = DRGY#: insertionPnt4(2) = 0#
  FileToInsert = "C:\DWG\CAA\file-to-be-inserted.dwg"
  Set BlockRef14 = ThisDrawing.ModelSpace.InsertBlock(insertionPnt4, FileToInsert, 1#, 1#, 1#, 0)
  'ZoomAll
End Sub

Print this item