Author Topic: las file import  (Read 5567 times)

0 Members and 1 Guest are viewing this topic.

GDF

  • Water Moccasin
  • Posts: 2081
las file import
« on: February 14, 2007, 04:25:44 PM »
Does anyone have a routine for importing and running a a las file?
This is a file made thru the Layers Property Manager....thru the Layer States Manager dialog box.

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

T.Willey

  • Needs a day job
  • Posts: 5251
Re: las file import
« Reply #1 on: February 14, 2007, 05:22:53 PM »
This one is pretty simple (meaning command oriented).
Code: [Select]
(setq sfile (getfiled "Select layer state file (.las)." "C:\\ACADSUPP2006\\SYMBOLS\\Facilities\\General\\" "las" 16))
(command "_.layer" "_a" "_i" sfile "_r" (vl-filename-base sfile) "" "")
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: las file import
« Reply #2 on: February 14, 2007, 05:47:54 PM »
Thats essentially how I do it too.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: las file import
« Reply #3 on: February 14, 2007, 05:59:59 PM »
One thing I should note is, that if the layer state is already in the drawing, then you need to delete it, IIRC.  In my case the exported layer state is the same name as the layer state itself.

So this is the code I used to check to see if it is in the drawing.
Code: [Select]
(defun ChkLayState (name / DICTS FOUND LAYS STATES)
; By Jeff Mishler
; Modified by Tim Willey

(setq lays (vla-get-layers (vla-get-activedocument (vlax-get-acad-object))))
(if (vla-get-HasExtensionDictionary lays)
 (progn
  (setq dicts (vla-getextensiondictionary lays))
  (vlax-for x dicts
   (if (= (vla-get-name x) "ACAD_LAYERSTATES")
    (setq states x)  (if (ChkLayState (vl-filename-base sfile))
   (DelLayState (vl-filename-base sfile))
  )
   )
  )
  (if states
   (progn
    (vlax-for x states
     (if (= (vla-get-name x) name)
      (setq found t)
     )
    )
   )
  )
 )
);if
found
)
If so then I delete it with
Code: [Select]
(defun DelLayState (layName / *acad LState)
; Modified from code provided by James Buzbee
; works in A2K4

(setq *acad (vlax-get-acad-object))
(setq LState (vla-GetInterFaceObject *acad "AutoCAD.AcadLayerStateManager.16"))
(if LState
 (progn
  (vla-setdatabase LState (vla-get-database (vla-get-ActiveDocument *acad)))
  (vla-delete LState layname)
 )
)
(vlax-release-object LState)
)
Both used like
Code: [Select]
  (if (ChkLayState (vl-filename-base sfile))
   (DelLayState (vl-filename-base sfile))
  )
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

GDF

  • Water Moccasin
  • Posts: 2081
Re: las file import
« Reply #4 on: February 15, 2007, 10:40:06 AM »
This one is pretty simple (meaning command oriented).
Code: [Select]
(setq sfile (getfiled "Select layer state file (.las)." "C:\\ACADSUPP2006\\SYMBOLS\\Facilities\\General\\" "las" 16))
(command "_.layer" "_a" "_i" sfile "_r" (vl-filename-base sfile) "" "")

Thanks Tim, that was too easy. That is what I was looking for. Thanks.

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

GDF

  • Water Moccasin
  • Posts: 2081
Re: las file import
« Reply #5 on: February 15, 2007, 10:45:41 AM »
One thing I should note is, that if the layer state is already in the drawing, then you need to delete it, IIRC.  In my case the exported layer state is the same name as the layer state itself.

So this is the code I used to check to see if it is in the drawing.

I missed seeing this...I'm trying to open my eyes up. Thanks again. I have never used the layer.las files.
I thought that I would give them a try. In the past I've used layer.scr files.

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

T.Willey

  • Needs a day job
  • Posts: 5251
Re: las file import
« Reply #6 on: February 15, 2007, 11:21:22 AM »
Cool.  Hope it works the way you want it to.  What are you trying to do?  I just used it so that the layers I have in the current drawing, would match the standard layers, ie. color and linetype.  Now I wrote one to copy layers, and if they exist, it prompts you to overwrite them, or you can choose not to overwrite them, or to overwrite them all.  It is posted here if it sounds like something you want.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

GDF

  • Water Moccasin
  • Posts: 2081
Re: las file import
« Reply #7 on: February 15, 2007, 12:08:33 PM »
My goal is to set up a standard layer states for each of my standard sheet file types.
(tobe used as a good starting point for setting up the layer settings)

We use a lot of xrefs in setting up our buildings types. For example an overall profile
building can have up to eight different building types. And each of these different
building types can have up three of four different unit types. So that the overall
profile building can get pretty big and hard to manage with all of the correct layer
settings for each of the sheet files in the construction document set. Different sheet
drawings types require different paper space layer settings.

I have played around with script files and the express tools lman routine.
Now it's time to try something different....Layer States Manager.

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

T.Willey

  • Needs a day job
  • Posts: 5251
Re: las file import
« Reply #8 on: February 15, 2007, 12:32:05 PM »
Cool.  Have fun with it.  I think there is a post of how to make layer states on the fly.  I think I posted a solution and so did MP.  You might want to look at that if you think layer states are the way you want to go.  Then no need to import them, just create them within the drawing.  Just an idea.  :-D
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: las file import
« Reply #9 on: February 15, 2007, 01:31:30 PM »
Gary, I have something that may be of interest to you:



This application uses an external file that has all our standard Layer States.  It doesn't import them - it reads them via ObjectDBX and matches layer properties.  1) this doesn't import all layers into the drawing - as the las file does (we have over 700 layers). 2) you can independently control an xrefs layer via the dialog.  The list on the left are the current xrefs - the list on the right are the available layer states.  This is a simple lisp engine using a VBA form.  The form is modeless, has 4 transparency settings, rolls-up to toolbar size, and comes with some view tools on the other pane.  Let me know if your interested to try it out - it will take some minimum setup time but the benifits are well worth it.
James Buzbee
Windows 8

GDF

  • Water Moccasin
  • Posts: 2081
Re: las file import
« Reply #10 on: February 15, 2007, 02:31:08 PM »
Gary, I have something that may be of interest to you:



This application uses an external file that has all our standard Layer States.  It doesn't import them - it reads them via ObjectDBX and matches layer properties.  1) this doesn't import all layers into the drawing - as the las file does (we have over 700 layers). 2) you can independently control an xrefs layer via the dialog.  The list on the left are the current xrefs - the list on the right are the available layer states.  This is a simple lisp engine using a VBA form.  The form is modeless, has 4 transparency settings, rolls-up to toolbar size, and comes with some view tools on the other pane.  Let me know if your interested to try it out - it will take some minimum setup time but the benifits are well worth it.

Thanks Tim

James, yes that sound like something I could really use. Thanks.

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: las file import
« Reply #11 on: February 15, 2007, 10:38:00 PM »
Do you use ADT?  Mine is tied in with some of ADT's stuff but here is a little stand alone version.  It doesn't have as robust a GUI but it will give you an idea.  If you want the zippy one I'll have to do a little work.  No big deal it will just take a little time. This was written for ACAD 2000 - 2006 ( I don't have 2007 yet <gasp>).
James Buzbee
Windows 8

GDF

  • Water Moccasin
  • Posts: 2081
Re: las file import
« Reply #12 on: February 16, 2007, 12:22:28 PM »
Do you use ADT?  Mine is tied in with some of ADT's stuff but here is a little stand alone version.  It doesn't have as robust a GUI but it will give you an idea.  If you want the zippy one I'll have to do a little work.  No big deal it will just take a little time. This was written for ACAD 2000 - 2006 ( I don't have 2007 yet <gasp>).

James

Thanks. I only use AutoCAD 2007, no ADT stuff. I will play with it this weekend.
You will like 2007, they have really improved the xref manager (the "file references" manager).

Never worked with vba.

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: las file import
« Reply #13 on: February 16, 2007, 01:11:14 PM »
I don't know if the .dvb will work in 2007?  I'm starting to really hate microsoft.  Let me know if not - and I can post the resource files and walk you through starting a project in te VBA ide.

jb
James Buzbee
Windows 8

GDF

  • Water Moccasin
  • Posts: 2081
Re: las file import
« Reply #14 on: February 16, 2007, 04:27:08 PM »
I don't know if the .dvb will work in 2007?  I'm starting to really hate microsoft.  Let me know if not - and I can post the resource files and walk you through starting a project in te VBA ide.

jb

James

I just tried it in 2007 and got a run-time error. Automation error. The specified module could not be found.

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

Gunnar_L

  • Guest
Re: las file import
« Reply #15 on: March 27, 2014, 10:25:10 AM »
This one is pretty simple (meaning command oriented).
Code: [Select]
(setq sfile (getfiled "Select layer state file (.las)." "C:\\ACADSUPP2006\\SYMBOLS\\Facilities\\General\\" "las" 16))
(command "_.layer" "_a" "_i" sfile "_r" (vl-filename-base sfile) "" "")

Hi. Could someone please make a lisp with this code,  that will also look in a folder and import all .las files in that folder one by one?

Thank´s in advance!
BR /GL