Recent Posts

Pages: [1] 2 3 ... 10
1
.NET / Re: Linetype scaling differs for unknown reason
« Last post by damien_conroy on Today at 03:00:28 PM »
Erasing the linetypes caused problems with the layers defaulting back to linetype continuous, so I just used the editor.command() for reloading linetypes.

adapted from https://adndevblog.typepad.com/autocad/2012/03/how-to-reload-the-line-type-in-autocad-using-autocadnet-api.html
Code: [Select]
            if (bReload)
            {
                //dataArry[0] = "-linetype Load Dashed\nacad.lin\nYes\n ";
                ed.Command("_.linetype", "Load", "Dashed", "acad.lin", "Yes", "");
            }
            else
            {
                //dataArry[0] = "-linetype Load Dashed\nacad.lin\n ";
                ed.Command("_.linetype", "_Load", "_Dashed", "_acad.lin", "");
            }

2
.NET / Re: Linetype scaling differs for unknown reason
« Last post by damien_conroy on May 11, 2024, 04:54:21 PM »
the code is pretty sprawling/ugly so I wouldn't know what to include, and I think this might be more of an Autocad skills problem than coding skills problem.
Simplified process for plugin:
Cleanup and prep drawing
calculate size of plot
create layout, control the size by Viewport.ViewHeight (copy paste from Kean Walmsley)
do the plugin functionality, includes drawing some new polyline 2d

edit: found the solution, wasn't the code so I'm removing the code snippet, unsure of what I'm allowed to share. The problem was solved by erasing and reloading the linetypes, not sure of why that helped.
3
.NET / Re: Linetype scaling differs for unknown reason
« Last post by kdub_nz on May 11, 2024, 04:23:26 PM »
Hi Damien,
We'd probably need to see the code you're using.

I assume you are saving the drawing after you make the changes ?

I haven't done any plotting to .png, so have no knowledge of pitfalls in that regard.

Regards,

added:
Is there any common factor for the files that fail to plot sucessfully ?
4
.NET / Linetype scaling differs for unknown reason
« Last post by damien_conroy on May 11, 2024, 10:43:45 AM »
I am using a c# plugin to do some changes to a file and then prepare a properly scaled viewport for plotting a png, then in a batch script I'm applying this to thousands of files with accoreconsole.exe where I load the file, apply the plugin, and plot.

On some files the linetypescaling isn't coming out as expected and I can't find the reason for this. LTSCALE and PSLTSCALE are the same on all files, what other settings should I be looking at?

edit: forgot to add, the linetype scaling is different after plotting from accoreconsole than it is after running the plugin in editor, that's another head scratcher for me, is it connected to the first issue? 
5
Seem to remember open a pdf direct just like this (startapp "notepad" "D:\\acadtemp\\test.lsp")

Something a simple as (command "_start" "D:\\acadtemp\\newblock-02.pdf") Worked in my Bricscad.
6
XDRX-API / [XDrX-Function(42)] string sort
« Last post by xdcad on May 10, 2024, 09:39:23 PM »
xdrx-string-logical<

Used to compare two strings in logical order. This function is typically used to sort a list of files to ensure that the files are arranged in a logical order that humans understand, rather than a simple dictionary order.

example:

Command: (acad_strlsort (list "file200.txt" "file100.txt" "file10.txt" "file5.txt"))
("file10.txt" "file100.txt" "file200.txt" "file5.txt")


Command: (vl-sort (list "file200.txt" "file100.txt" "file10.txt" "file5.txt") '(lambda(x y)(xdrx-string-logical< x y)))
("file5.txt" "file10.txt" "file100.txt" "file200.txt")

Code - Auto/Visual Lisp: [Select]
  1. (defun xd::string:sortlist (strl)
  2.   (vl-sort strl '(lambda (x y) (xdrx_string_logical< x y)))
  3. )
  4.  
  5. ;assoc string list sort
  6.  
  7. (defun xd::string:assocsortlist (strl)
  8.   (vl-sort strl '(lambda (x y) (xdrx_string_logical< (car x)(car y))))
  9. )


xd::string:assocsortlist
_$

(("file100.txt" (1 2 3)) ("file0.txt" (1 2 3)) ("file20.txt" (1 2 3)) ("file300.txt" (1 2 3)))
(("file0.txt" (1 2 3)) ("file20.txt" (1 2 3)) ("file100.txt" (1 2 3)) ("file300.txt" (1 2 3)))
_$
7
I have lsip that opens Microsoft Edge and then launches my default PDF reader using a function called. Here's the code
(If someone knows who should get credit for this I am more than willing to remark it
Code: [Select]
(defun launchpdf (pdfname / shell)
  (vl-load-com)
  (setq pdfname (vl-string-translate "|" "\\" pdfname))
  (setq shell
        (vla-getinterfaceobject
          (vlax-get-acad-object)
          "Shell.Application"
        )
  )
  (vlax-invoke-method shell 'Open pdfname)
  (vlax-release-object shell)
  (princ)
)

(defun c:cheats ()
  (launchpdf "https://teams.company/revit//revitblog/PublishingImages/New%20user%20Packet/cheatsheet.pdf")
)


However, I'm encountering an issue with hosting a PDF cheatsheet on our company server. Currently, I'm only able to access it via an HTTPS link. Is there a workaround to enable me to keep the cheatsheet on our company server? If I launch the pdf off my computer it works the way I want.

Code: [Select]
(defun c:cheats ()
  (launchpdf "\\\\dt-lshaw2\\dcapps\\help.pdf")
)

Unfortunately, IT has been unable to provide a non-HTTPS link. Any suggestions on how to resolve this would be appreciated."
8
CAD General / Re: Batch Find & Replace Text AutoCAD 2023
« Last post by Lee Mac on May 10, 2024, 12:46:23 PM »
Try setting LISPSYS to 0.
9
AutoLISP (Vanilla / Visual) / Re: 3d polyline splitting
« Last post by ribarm on May 10, 2024, 10:52:29 AM »
@mariolino0099
I've fixed (while) endless loop, but it doesn't follow exact math because segments lengths are less than 0.7 units, so if I divide it with 0.7 and (fix) that number I get 0 - which gives another error - divide by zero... So, I had to include one (if) statement that will ensure that your first *.DWG is processed correctly with verices numbers like you presented on right side 3d polyline, and your second *.DWG is processed with that second - else (if) statement (setq n (fix (1+ (/ dd d)))) ... That 1+ is to ensure that divide by zero doesn't occur...
So, test my codes now, as I think that better than this is not neccessary...
Pages: [1] 2 3 ... 10