au-s Posted November 2, 2010 Posted November 2, 2010 Hi guys, Got a little problem. I have a file, lets call it 1.dwg saved in c:\\one\\two\\three\\four I have another file I want to preview and insert to my 1.dwg in c:\\one\\two\\here\\Iam Now I do this to get absolutepath to the drawing: [font=Arial][font=Arial](setq absolutepath (strcat (getvar "DWGPREFIX") )) [/font] [/font] Then to get the path to the other drawin I want to insert I do: [font=Arial][font=Arial][font=Arial](setq path1 (dos_absolutepath absolutepath "..\\..\\here\\Iam"))[/font] [/font][/font] That gives me c:\\one\\two\\here\\Iam, exactly what I want. I preview that then with: (setq file (dos_dwgpreview "Choose File:" path1 ".dwg")) BUT, the problem is that I need to open the drawing first from the right path "c:\\one\\two\\three\\four for that to take effect. If I, say open it in another path, like c:\\get\\this\\right\\here and save as in c:\\one\\two\\three\four that doesn't work and will point to c:\\get\\this\\here\\Iam. So, I have to open it in the right path to get the lisp to work its way to the right folder. Now, that isn't really a problem but it's irritating. You can always warn a user to save as in the right path and then reopen it. And without any experiance I say that "I don't think that substr works here". That because of folder-structures and paths, see below. c:\\project1\\one\\two\\three\\four c:\\project2\\one\\two\\three\\four Of course, that requires DOSlib for the dos_absolutepath to work. And I do have that, allthough maybe there's another way but I do find DOSlib helpfull sometimes. Quote
au-s Posted November 2, 2010 Author Posted November 2, 2010 Okay, I was wrong about substr. I used substr. Allthough the same problem. You have to open it from the right location to trigger the lisp Quote
au-s Posted November 2, 2010 Author Posted November 2, 2010 it seems to work so far when I do: (setq absolutepath (strcat (getvar "DWGPREFIX")) path1 (substr absolutepath 1 32) stamppath (strcat path1 "here\\Iam") ) All in one setq that is Quote
Lee Mac Posted November 2, 2010 Posted November 2, 2010 I haven't read the whole thread as yet, but FYI: (setq absolutepath (strcat (getvar "DWGPREFIX")) You aren't concatenating strings so you don't need the strcat. (setq absolutepath (getvar "DWGPREFIX") It won't affect whether it works or not though. Quote
au-s Posted November 3, 2010 Author Posted November 3, 2010 (edited) Yeah, the lisp is working perfectly but I need to OPEN the drawing from the right location first. I can't ie open a template.dwt and then save as in right location and run the lisp. It won't work. it will then try to make the path1 from the template location. BUT when I open it from the right location then it somehow knows how to behave Edited November 3, 2010 by au-s Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.