KHTMFile πŸ’Ύ
1.27K subscribers
1.18K photos
341 videos
386 files
465 links
Subscribe PSD AI CDR
Download Telegram
៨០០០ αžšαŸ€αž› αžαŸ‚αž”αŸ‰αž»αžŽαŸ’αžŽαŸ„αŸ‡ αžŸαž˜αŸ’αžšαžΆαž”αŸ‹αž”αž„αž”αŸ’αž’αžΌαž“αžαŸ’αžšαžΌαžœαž€αžΆαžš KH-Ractangle αžšαž™αŸˆαž–αŸαž›αž˜αž½αž™αžŸαž”αŸ’αžŠαžΆαž αŸαž‘αŸαŸ”#CorelDraw
 Sub NestObjects()
Dim s As Shape, sr As ShapeRange
Dim areaWidth As Double, areaHeight As Double
Dim xOffset As Double, yOffset As Double
Dim currentX As Double, currentY As Double
Dim maxHeightInRow As Double

ActiveDocument.Unit = cdrMillimeter

' Define the area where you want to nest the objects
areaWidth = 750 ' Width of the area
areaHeight = 750 ' Height of the area

Set sr = ActiveSelectionRange
If sr.Count = 0 Then
MsgBox "Please select objects to nest."
Exit Sub
End If

' Initialize the starting position and offsets
currentX = 0
currentY = 0
maxHeightInRow = 0
xOffset = 1 ' Fixed distance between objects horizontally
yOffset = 1 ' Fixed distance between objects vertically

For Each s In sr
' Check if the object fits in the current row, otherwise try rotating
If (currentX + s.SizeWidth) > areaWidth Then
s.Rotate 90
If (currentX + s.SizeWidth) > areaWidth Then
' If it still doesn't fit, move to the next row
s.Rotate -90 ' Rotate back to the original orientation
currentX = 0
currentY = currentY + maxHeightInRow + yOffset
maxHeightInRow = 0
End If
End If

' Check if the object fits in the area, otherwise stop the macro
If (currentY + s.SizeHeight) > areaHeight Then
MsgBox "Not all objects could be nested within the specified area."
Exit Sub
End If

' Move the object to the current position
s.SetPosition currentX, currentY

' Update the current position and the max height in the current row
currentX = currentX + s.SizeWidth + xOffset
If s.SizeHeight > maxHeightInRow Then
maxHeightInRow = s.SizeHeight
End If
Next s
End Sub
Private Declare  Function GetAsyncKeyState Lib "user32" (ByVal vKey&) As Long 

Add code
PtrSafe
αž’αŸ’αžœαžΎαžŠαŸ„αž™αžŠαŸƒαž€αŸαž™αžΌαžš αž”αŸ’αžšαžΎαž‡αŸ†αž“αž½αž™αž€αŸαž›αžΏαž“ αžαŸ’αž‰αž»αŸ†αž‡αŸ’αžšαžΎαžŸαžšαžΎαžŸαž‡αŸ†αž“αž½αž™αž αžΎαž™ αž”αŸ‚αž”αž“αŸαŸ‡αŸ”
Step 2: Add VBA Code to the UserForm
UserForm Code
Add the following code to the UserForm:
Private Sub btnExport_Click()
' Call the export function with user inputs
ExportFiles txtFilePath.Text, chkDXF.Value, chkEPS.Value, chkPLT.Value
End Sub

Private Sub btnCancel_Click()
' Unload the form
Unload Me
End Sub

Private Sub btnBrowse_Click()
' Call the function to browse for a folder
txtFilePath.Text = BrowseForFolder("Select a folder for export")
End Sub

Function BrowseForFolder(Optional title As String = "Select a folder") As String
Dim fd As FileDialog
Set fd = Application.FileDialog(msoFileDialogFolderPicker)
With fd
.Title = title
If .Show = -1 Then ' If the user selects a folder
BrowseForFolder = .SelectedItems(1)
Else ' If the user cancels
BrowseForFolder = ""
End If
End With
End Function
Step 3: Update the Module Code
Module Code
Add the following code to a new or existing module:
Sub ExportFiles(folderPath As String, exportDXF As Boolean, exportEPS As Boolean, exportPLT As Boolean)
Dim doc As Document
Set doc = ActiveDocument

If folderPath = "" Then
MsgBox "Please select a folder for export.", vbExclamation
Exit Sub
End If

Dim fileName As String
fileName = folderPath & "\" & doc.Name

' Ensure fileName is valid by removing invalid characters
fileName = Replace(fileName, ":", "_")
fileName = Replace(fileName, "\", "_")
fileName = Replace(fileName, "/", "_")
fileName = Replace(fileName, "*", "_")
fileName = Replace(fileName, "?", "_")
fileName = Replace(fileName, """", "_")
fileName = Replace(fileName, "<", "_")
fileName = Replace(fileName, ">", "_")
fileName = Replace(fileName, "|", "_")

On Error Resume Next

If exportDXF Then
Call ExportDXF(fileName & ".dxf")
End If

If exportEPS Then
doc.Export fileName & ".eps", cdrEPS
If Err.Number <> 0 Then
MsgBox "Error exporting to EPS: " & Err.Description, vbExclamation
Err.Clear
End If
End If

If exportPLT Then
doc.Export fileName & ".plt", cdrPLT
If Err.Number <> 0 Then
MsgBox "Error exporting to PLT: " & Err.Description, vbExclamation
Err.Clear
End If
End If

MsgBox "Export completed successfully!", vbInformation
End Sub

Sub ShowExportForm()
' Show the user form
ExportForm.Show
End Sub

Sub ExportDXF(fileName As String)
Dim OrigSelection As ShapeRange
Set OrigSelection = ActiveSelectionRange
OrigSelection.CreateSelection
Dim expopt As StructExportOptions
Set expopt = CreateStructExportOptions
expopt.UseColorProfile = True
Dim expflt As ExportFilter
Set expflt = ActiveDocument.ExportEx(fileName, cdrDXF, cdrSelection, expopt)
With expflt
.BitmapType = 0 ' FilterDXFLib.dxfBitmapJPEG
.TextAsCurves = True
.Version = 6 ' FilterDXFLib.dxfVersion9
.Units = 0 ' FilterDXFLib.dxfInches
.FillUnmapped = True
.FillColor = 0
.Finish
End With
End Sub
This media is not supported in your browser
VIEW IN TELEGRAM
αžαŸ’αžœαŸ‡αžαžœαž·αž€αžΆ αžŠαžΎαž˜αŸ’αž”αžΈαž”αž„αŸ’αž αžΎαž™αž€αžΆαžšαž„αžΆαžšαž…αŸ‚αž€αžšαŸ†αž›αŸ‚αž€ αž˜αž½αž™αž“αŸαŸ‡αŸ”πŸ™πŸ™πŸ™πŸ™πŸ™ αž‘αžΆαž‰αž™αž€αž“αžΌαžœαž‘αžΈαž“αŸαŸ‡
😁2😱1
KH-Frame.gms
192 KB
αžŸαžΆαž›αŸ’αž”αž„αž”αžΆαž“ αžŸαžΌαž˜αž…αŸ‚αž€αžšαŸ†αž›αŸ‚αž€αžŠαž›αŸ‹αž”αž„αž”αŸ’αž’αžΌαž“αž‘αžΆαŸ†αž„αž’αžŸαŸ‹αž‚αŸ’αž“αžΆαžŠαŸ‚αž›αž“αž·αž™αž˜αž”αŸ’αžšαžΎαžαžΌαžšαŸαž›αžŠαŸ’αžš #CorelDRAW x6-2024
❀1
ActiveSelection.objectData("Name"). value = kh-01#
#CorelDRAW #%appdata% αžŸαž˜αŸ’αžšαžΆαž”αŸ‹αžŠαžΆαž€αŸ‹αž”αž‰αŸ’αž…αžΌαž›αž‘αŸ…αžαžΆαž˜αž‘αžΈαžαžΆαŸ†αž„ αž€αžΆαžšαž’αž—αž·αžœαžŒαŸ’αžαžšαž”αžŸαŸ‹αž€αž˜αŸ’αž˜αžœαž·αž’αžΈ
if not exist "%APPDATA%\Corel\CorelDRAW Graphics Suite X6\Draw\GMS\" mkdir "%APPDATA%\Corel\CorelDRAW Graphics Suite X6\Draw\GMS"
copy KHRECTANGLEv3.01.gms "%APPDATA%\Corel\CorelDRAW Graphics Suite X6\Draw\GMS"
αž…αž˜αŸ’αž›αž„ αžŸαžΌαž˜αž”αŸ’αžαžΌαžšαž–αžΆαž€αŸ’αž™ ( Runme.bat )
αž‘αžΆαž‰αž™αž€αžŸαžΆαž€αž›αŸ’αž”αž„αž›αŸαž„αž”αžΆαž“πŸ™