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



Search Forums

(Advanced Search)

Forum Statistics
» Members: 12
» Latest member: katy
» Forum threads: 4
» Forum posts: 4

Full Statistics

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

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

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

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

Then Create a Circle and Extrude it.

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

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

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

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

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

Case 2
CirObj.color = acCyan

Case 3
CirObj.color = acGreen

Case 4
CirObj.color = acRed

Case 5
CirObj.color = acYellow

Case 6
CirObj.color = acBlue

Case 7
CirObj.color = acMagenta

Case Else
'LinObj.color = acWhite
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)
End Sub

Print this item