Recent Posts

Pages: [1] 2 3 ... 10
1
AutoLISP (Vanilla / Visual) / Re: purge everything but layers
« Last post by BIGAL on May 15, 2024, 08:18:55 PM »
If you are using CIV3D run Purgestyleandsettings maybe twice before normal purge. It makes a big difference.
2
AutoLISP (Vanilla / Visual) / Re: Issue with Layout - Copy Command
« Last post by BIGAL on May 15, 2024, 08:15:24 PM »
Are you copying "Template" each time or last layout name created, may cause odd order.
3
AutoLISP (Vanilla / Visual) / Re: ALternative to ade_odgettables in BricsCAD
« Last post by BIGAL on May 15, 2024, 08:12:11 PM »
Did you ask at Bricscad forum or do a support request ? Bricscad staff do read the posts and respond.
4
AutoLISP (Vanilla / Visual) / Re: purge everything but layers
« Last post by 3dwannab on May 15, 2024, 07:21:05 PM »
As an aside, note that the purgeall method will also skip Multileader Styles when purging a drawing - this is a known bug.
Wow, 12 years on and this bug remains.

I guess this will have to do:
Code: [Select]
  ;; Purge using vla and normal method to purge MULTILEADERS as there's a bug with that using the vla method.
  (setq doc (vla-get-activedocument (vlax-get-acad-object)))
  (repeat 3 (vla-purgeall doc))
  ; Purge MULTILEADERS (no prompt), the above code doesn't purge MULTILEADERS. Known bug: https://www.theswamp.org/index.php?topic=42854.msg480733#msg480733
  (command "_.PURGE" "_MU" "*" "_N")
5
AutoLISP (Vanilla / Visual) / Re: How to Access Microsoft Graph via Visual Lisp?
« Last post by MickD on May 15, 2024, 04:51:41 PM »
Quote
I believe this would be the same concept as hard-coding it into our acad.lsp file

I'm not sure what you mean by this, your lisp just queries your api to get the data for the user (like your json return sample) and do what you need. If you mean you are using/instructing Graph itself to install MS app's (not lisp/arx app's in cad) then I understand.

As I mentioned, you can also use the web app as a go between to Graph (IT can still handle profiles), then you only need to register one application with Graph, only users on company machines will have access to the web app via your lisp so security risks are minimal.
Your problem at the moment is you would need to use some authentication to gain access and you don't want or need each user to have direct access, your lisp with web app is the gate keeper.

I hope that makes sense :)
6
AutoLISP (Vanilla / Visual) / Issue with Layout - Copy Command
« Last post by jnelson on May 15, 2024, 04:25:52 PM »
I have an existing lisp routine that makes copies of an existing "template" layout one by one using an alphabetized list of layout names.  For example, the "template" layout is named "TEMPLATE" and (to keep things simple) the list of names might be "A", "B", "C", etc.  The "Template" layout name is assigned to the TBLAYOUT variable, and the desired name of the copy is assigned to a variable named MAP.  The code looks like:

(command "layout" "copy" TBLAYOUT MAP)

This works fine, and the new layouts have previously all been arranged together at the bottom of the drawing editor in alphabetical order:

Model/A/B/C/D/E/TEMPLATE

However, beginning with AutoCAD 2019 and now AutoCAD 2024 (we skipped the versions in between) the new layouts do not stay in alphabetical order.  Instead, they may be arranged such as:

Model/C/D/E/TEMPLATE/A/B

This is not a big deal if there are a dozen or so layouts, but sometimes we have over a hundred and they can be annoying to put in order.  We do use Lee Mac's TabSort routine to fix it, but I'd like to get it right the first time, since the list is already in alphabetical order.

Any ideas why this is happening, and is there a simple solution that I'm overlooking?  Thank you.
7
AutoLISP (Vanilla / Visual) / Re: Apply Plot style table to all layout
« Last post by 3dwannab on May 15, 2024, 03:53:09 PM »
Added checking if the plot style exists.

Code: [Select]
;;----------------------------------------------------------------------;;
;; setPlotStyle FUNCTION
;; https://www.theswamp.org/index.php?topic=45000.msg502065#msg502065
;; Added checking if the plot style exists by 3dwananb on 2024.05.15

(defun setPlotStyle (ctb / CurDoc installedPs)
  (setq CurDoc (vla-get-ActiveDocument (vlax-get-acad-object)))
  (setq installedPs (vlax-safearray->list (vlax-variant-value (vla-GetPlotStyleTableNames (vla-get-ActiveLayout CurDoc))))) ;;get the plotstyles
  (if (/= nil (vl-position ctb installedPs))
    (progn
      (princ (strcat "\nPlot Style successfully set to: '" ctb "'\n"))
      (vlax-map-collection
        (vla-get-Layouts
          (vla-get-ActiveDocument (vlax-get-acad-object))
        )
        '(lambda (x) (vla-put-StyleSheet x ctb))
      )
    )
    (princ (strcat "\nPlot Style '" ctb "' not found!\n"))
  ) ;; if verify if the plotstyle exist, if not, print to the commandline.
)

(setPlotStyle "monochrome.ctb")
8
AutoLISP (Vanilla / Visual) / Re: ALternative to ade_odgettables in BricsCAD
« Last post by JasonB on May 15, 2024, 03:08:01 PM »
A similar query was raised here on the Bricsys forum
https://forum.bricsys.com/discussion/38119/gisimport

I don't see any options available using LISP in the developer help but i does look like there are options using .NET
https://developer.bricsys.com/bricscad/help/en_US/CurVer/DevRef/index.html
9
.NET / Re: PropertySetDefinition with a List data type
« Last post by Jeff_M on May 15, 2024, 02:43:18 PM »
Okay, more headway made. I finally realized that I needed a new class (PropList) to hold the list and the current value for the object. I have not yet been able to get the Combobox to display the list or current value. The DataTable is created properly, with the column for the List type created as a PropList type. Then in the Window the DataGrid's ItemsSource is set to the ViewModel's property for the DataTable. All the columns fill with the correct values, except that PropList column. One of the solutions I found in my searches says that adding this to the XAML should fix it:
Code - XML: [Select]
  1.                 <DataGrid.Resources>
  2.                     <DataTemplate x:Key="dataItemCellTemplate">
  3.                         <ComboBox SelectedValue="{Binding DataContext.CurrentValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
  4.                                    ItemsSource="{Binding DataContext.Values}"/>
  5.                     </DataTemplate>
  6.                 </DataGrid.Resources>
  7.  

Where CurrentValue and Values are the 2 properties of PropList. Then include this in the code behind for the AutoGeneratingColumn event:
Code - C#: [Select]
  1.             if (e.PropertyType == typeof(PropList))
  2.             {
  3.                 var col = new DataGridTemplateColumn
  4.                 {
  5.                     CellTemplate = (DataTemplate)PropData.FindResource("dataItemCellTemplate"),
  6.                     CellEditingTemplate = (DataTemplate)PropData.FindResource("dataItemCellTemplate"),
  7.                     Header = e.PropertyName
  8.                 };
  9.                 e.Column = col;
  10.                 return;
  11.             }
  12.  
But something is still amiss and I am at a loss on where to look.
10
Do you need to use MS Graph? If not you could build your own simple web server on the company intranet or host it in the cloud. Something like Go with SQLite db would be easy enough to setup, you could even register it and then use it with the MS Graph api to get extra data if needed.
^^^ I believe this would be the same concept as hard-coding it into our acad.lsp file. It would still need updated by me, but I'd rather have it come from Graph since IT has to update these profiles already anyways  ;-)

Of course, the conspiracist in me immediately thought, scan employee emails and feed them to an AI to build profiles  :evil:
:laugh: That would be bonkers. Plus, that's what Copilot M365 is for yeah?  :whistling:
Pages: [1] 2 3 ... 10