Author Topic: Not sure if this falls under LISP'ing, but...  (Read 4545 times)

0 Members and 1 Guest are viewing this topic.

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Not sure if this falls under LISP'ing, but...
« on: May 14, 2004, 10:49:35 AM »
I started looking at Blockwerx for the previews of blocks, problem is, a lot of our blocks were done way back in release 12, 13, & 14, thus, no previews.  Is there a way to open and save as 2004 .dwgs without doing it manually?  There's a butt-load of blocks that don't have previews, and I don't think assigning this task to the new guy is quite appropriate  :twisted:

Mark

  • Custom Title
  • Seagull
  • Posts: 28753
Not sure if this falls under LISP'ing, but...
« Reply #1 on: May 14, 2004, 11:18:40 AM »
here is one way, but not as good as using a script or program. Highlight some of the files in Windows Explorer, hit <enter>, that will open them in acad, then do a "saveall" (if you have Express Tools). repeat until done.
TheSwamp.org  (serving the CAD community since 2003)

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Not sure if this falls under LISP'ing, but...
« Reply #2 on: May 14, 2004, 11:39:19 AM »
That's what I thought too...but  for some reason, it didn't work for me...I'll try it again

EDIT:  Just tried it...opened 5 of them, express~save all, express~close all....they're all still in release 12 format.   :evil:

hendie

  • Guest
Not sure if this falls under LISP'ing, but...
« Reply #3 on: May 14, 2004, 01:36:22 PM »
even easier than that !!!!
now I'm at home and don't have Blockwerx at hand but I think I can remember the sequence...

Add the folder to your tab list (or this can be done even in the browse window)
Select the tab, right click, select properties.
Now under the dialogue which presents itself, somewhere on their is the option to use slides or thumbnails ~ select SLIDES, why ? 'cos their better to view, that's why.
Now you'll find that nothing shows up in the Blockwerx window because it's looking for slides and you don't have any... bummer... all you'll see is a lot of missing slide messages.
Now Right click on the tab (or possibly one of the windows) and you have a nice menu from which you can select. and if I were you I would especially select REDRAW MISSING SLIDES
you will then get a message asking if you want to run a script ~ think about it then hit yes and guess what ? Blockwerx goes through the whole directory and creates a slide FOR EACH ONE of your files !

now isn't that nifty and saved you an awful lot of work !

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Not sure if this falls under LISP'ing, but...
« Reply #4 on: May 14, 2004, 02:35:15 PM »
Hendie...tried that...didn't work...BUT...I switched it back to the Thumbnail view, and did the same thing, this time redrawing the thumbnails, not the slides, and it worked perfectly!! Thanks....we might have to purchase this program....still trying it out...but I likes what I sees :twisted:

hendie

  • Guest
Not sure if this falls under LISP'ing, but...
« Reply #5 on: May 14, 2004, 03:02:23 PM »
if it worked with the thumbnails, there's no reason why it shouldn't have worked with the slides.
check under your viewing preferences that  "slide" is selected as the default.
sorry i can't help you more but I'm at home and Blockwerx ain't.
I'll try to remember on Monday to have alook and I'll give you all the info you need to set it up for viewing and creating the slides.

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Not sure if this falls under LISP'ing, but...
« Reply #6 on: May 14, 2004, 03:53:21 PM »
maybe I didn't set it to the default, maybe just the current view...it did say "no slide" , then when I'd run the script, it didn't seem to work...the thumbnail preview worked a lot easier, IMO, but thank you for getting me going...

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Not sure if this falls under LISP'ing, but...
« Reply #7 on: May 14, 2004, 04:45:04 PM »
Ok use this.....It works wonderfully for me.....

Copy and paste it into a new VBA Module, then select FixPreview from the Macro list.

Code: [Select]

Option Explicit

Private Declare Function GetCurrentVbaProject _
 Lib "vba332.dll" Alias "EbGetExecutingProj" _
 (hProject As Long) As Long
Private Declare Function GetFuncID _
 Lib "vba332.dll" Alias "TipGetFunctionId" _
 (ByVal hProject As Long, ByVal strFunctionName As String, _
 ByRef strFunctionId As String) As Long
Private Declare Function GetAddr _
 Lib "vba332.dll" Alias "TipGetLpfnOfFunctionId" _
 (ByVal hProject As Long, ByVal strFunctionId As String, _
 ByRef lpfn As Long) As Long

Public Type BROWSEINFO
    hOwner As Long
    pidlRoot As Long
    pszDisplayName As String
    lpszTitle As String
    ulFlags As Long
    lpfn As Long
    lParam As Long
    iImage As Long
End Type

Public Const MAX_PATH = 2600

Declare Function SHBrowseForFolder Lib "shell32.dll" _
Alias "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As Long

Declare Function SHGetPathFromIDList Lib "shell32.dll" _
Alias "SHGetPathFromIDListA" (ByVal pidl As Long, _
ByVal pszPath As String) As Long

Public Declare Function LocalAlloc Lib "kernel32" _
   (ByVal uFlags As Long, _
    ByVal uBytes As Long) As Long

Public Declare Sub CopyMemory Lib "kernel32" _
   Alias "RtlMoveMemory" _
   (pDest As Any, _
    pSource As Any, _
    ByVal dwLength As Long)
   
Declare Function SendMessage Lib "user32" _
Alias "SendMessageA" (ByVal HWND As Long, _
                      ByVal wMsg As Long, _
                      ByVal wParam As Long, _
                      ByVal lParam As Long) As Long


Public Const WM_USER = &H400
Public Const BFFM_INITIALIZED = 1
Public Const BFFM_SETSTATUSTEXTA As Long = (WM_USER + 100)
Public Const BFFM_SETSTATUSTEXTW As Long = (WM_USER + 104)
Public Const BFFM_ENABLEOK As Long = (WM_USER + 101)
Public Const BFFM_SETSELECTIONA As Long = (WM_USER + 102)
Public Const BFFM_SETSELECTIONW As Long = (WM_USER + 103)
Public Const LMEM_FIXED = &H0
Public Const LMEM_ZEROINIT = &H40
Public Const LPTR = (LMEM_FIXED Or LMEM_ZEROINIT)

Public Function ReturnFolder(Title As String) As String
  Dim Browser As BROWSEINFO
  Dim lngFolder As Long
  Dim strPath As String
  Dim sSelPath As String
  Dim lpSelPath As Long
  'Change the path "C:\Drawings" to point to your default folder
  sSelPath = GetSetting("ReturnFolder", "Path", "Last", "C:\Drawings")
  lpSelPath = LocalAlloc(LPTR, Len(sSelPath) + 1)
  CopyMemory ByVal lpSelPath, ByVal sSelPath, Len(sSelPath) + 1

  With Browser
    .hOwner = 0&
    .lpszTitle = Title
    .pszDisplayName = String(MAX_PATH, 0)
    .pidlRoot = 0
    .lpfn = AddrOf("BrowseCallbackProcStr")
    .lParam = lpSelPath
  End With
  SendMessage 0&, BFFM_SETSELECTIONW, True, ByVal lpSelPath
  strPath = String(MAX_PATH, 0) '<-- VERY Important!!
  lngFolder = SHBrowseForFolder(Browser)
  If lngFolder Then
    SHGetPathFromIDList lngFolder, strPath
    ReturnFolder = Left(strPath, InStr(strPath, vbNullChar) - 1)
    SaveSetting "ReturnFolder", "Path", "Last", Left(strPath, InStr(strPath, vbNullChar) - 1)
  End If
End Function
Public Function BrowseCallbackProcStr(ByVal HWND As Long, _
                                      ByVal uMsg As Long, _
                                      ByVal lParam As Long, _
                                      ByVal lpData As Long) As Long
                                       
  'Callback for the Browse STRING method.
 
  'On initialization, set the dialog's
  'pre-selected folder from the pointer
  'to the path allocated as bi.lParam,
  'passed back to the callback as lpData param.
 
   Select Case uMsg
      Case BFFM_INITIALIZED
     
         Call SendMessage(HWND, BFFM_SETSELECTIONA, _
                          True, ByVal lpData)
                         
         Case Else:
         
   End Select
         
End Function
Public Function AddrOf(strFuncName As String) As Long
    Dim hProject As Long
    Dim lngResult As Long
    Dim strID As String
    Dim lpfn As Long
    Dim strFuncNameUnicode As String
   
    Const NO_ERROR = 0
   
    ' The function name must be in Unicode, so convert it.
    strFuncNameUnicode = StrConv(strFuncName, vbUnicode)
   
    ' Get the current VBA project
    ' The results of GetCurrentVBAProject seemed inconsistent, in our tests,
    ' so now we just check the project handle when the function returns.
    Call GetCurrentVbaProject(hProject)
   
    ' Make sure we got a project handle... we always should, but you never know!
    If hProject <> 0 Then
        ' Get the VBA function ID (whatever that is!)
        lngResult = GetFuncID( _
         hProject, strFuncNameUnicode, strID)
       
        ' We have to check this because we GPF if we try to get a function pointer
        ' of a non-existent function.
        If lngResult = NO_ERROR Then
            ' Get the function pointer.
            lngResult = GetAddr(hProject, strID, lpfn)
           
            If lngResult = NO_ERROR Then
                AddrOf = lpfn
            End If
        End If
    End If
End Function

Sub FixPreview()
 Dim CurrentDwg As AcadDocument
 Dim File As Variant
 Dim Folder As String
 ThisDrawing.SetVariable "Acadlspasdoc", 0
 Folder = ReturnFolder("File location to generate previews: ")
 File = Dir(Folder & "\*.DWG")
 While File <> ""
  Set CurrentDwg = Application.Documents.Open(Folder & "\" & File)
  CurrentDwg.Activate
  Application.ZoomExtents
  CurrentDwg.Close True
  Set CurrentDwg = Nothing
  File = Dir
 Wend
 ThisDrawing.SetVariable "Acadlspasdoc", 1
End Sub


Comments?
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

hendie

  • Guest
Not sure if this falls under LISP'ing, but...
« Reply #8 on: May 17, 2004, 10:10:10 AM »
Right click on tab at top, select SETTINGS,
On library tab, make sure you have SLIDE selected under the VIEW BY section
Add a description for the library etc

If you don’t see any SLIDES, after you’ve changed the settings, simply right click on the tab at the top again and select REDRAW ALL SLIDES.

On the SLIDE VIEW tab, you can select the number of columns and rows to show. This setting is tab specific so it’s useful for having different settings for each library tab, depending upon the complexity of the slides on show.

I recommend using slides because slides are vector based therefore you can scale them up or down without sacrificing quality. If you choose to view bitmaps, the resolution is hopeless if you scale the view up at all.  
(right click on any of your blocks showing and select VIEW ~  SLIDE… a small window pops up with the slide showing. You can now drag that window to any size and you’ll see that the quality of the slide does not degenerate.
Also, if you wish the print the complete library, selecting slides gives you much better quality.

pmvliet

  • Guest
Not sure if this falls under LISP'ing, but...
« Reply #9 on: May 18, 2004, 01:16:49 PM »
the other way that you can do this is download the batch file converter for AutoCad. This will save any version from any version. or at least it will save from lower version's to upper versions.

The migration tools for 2002, had this as "batch drawing converter"
I use this all the time to save up and get the thumbnails. You have to make sure the profile you are using creates thumbnails upon a save.

I believe you can stay in the same version just to have it go through the motions.


Pieter