deeplop.blogg.se

How to add block to tool palette in autocad
How to add block to tool palette in autocad





ToString(tv1.Value) Ģ26 string lspScrPath = Convert. NET doesn't generate aġ40 // thumbnail in the resultant file (or its Database)ġ43 // db.SaveAs(dwgPath, false, DwgVersion.Current, null) ġ46 // AcadDocument adoc = (AcadDocument)doc.AcadDocument ġ47 // adoc.SaveAs(dwgPath, AcSaveAsType.acNative, null) ġ49 // So we'll send commands to the command-lineġ50 // We'll use LISP, to avoid having to set FILEDIA to 0ġ52 object ocmd = Application.GetSystemVariable( "CMDECHO" ) ġ53 string dwgPath2 = dwgPath.Replace(pthSep, lspSep) ġ54 string scrPath2 = scrPath.Replace(pthSep, lspSep) ġ58 "(command \"_.SAVEAS\" \"\" \"" + dwgPath2 + "\")" ġ60 "(setvar \"CMDECHO\" " + ocmd.ToString() + ")" +ġ61 "(tp-create \"" + name + "\" \"" + scrPath2 + "\")" +ġ67 doc.SendStringToExecute(cmd, false, false, false ) ġ71 doc.SendStringToExecute(c1+ " ", false, false, false ) ġ72 doc.SendStringToExecute(c2, false, false, false ) ġ75 // Print a confirmation message for the DWG saveġ76 // (which actually gets displayed before the queuedġ79 ed.WriteMessage( "\nSaved to: \"" + dwgPath + "\"" ) ġ85 // Our LISP-registered continuation function to create aġ89 public ResultBuffer CreateToolPaletteCommand(ġ96 Ģ01 ed.WriteMessage( "\nError: too few arguments." ) Ģ05 // We're only interested in the first two argumentsĢ11 "\nError: wrong number of arguments."Ģ16 // First argument is the name, second is the pathĢ19 TypedValue tv1 = (TypedValue)args.GetValue(0) Ģ20 TypedValue tv2 = (TypedValue)args.GetValue(1) Ģ22 if (tv1 != null & tv1.TypeCode = RTSTR &Ģ23 tv2 != null & tv2.TypeCode = RTSTR)Ģ25 string name = Convert.

how to add block to tool palette in autocad

1 using Ģ using ĥ using ġ4 // Set up static variable for the path to our folderġ5 // of drawings, as well as the base filename and aġ6 // counter to make the unique filenameĢ2 // Various filename and path-related constantsĤ0 Ĥ8 // Ask the user for a base file locationĥ2 "Select location to save first drawing file"ĥ4 opts.Filter = "Drawing (*.dwg)|*.dwg" ĥ9 // (may be a problem if the file is in use)ħ2 // If a file was selected, and it contains a path.ħ6 // Separate the path from the file nameħ8 int idx = pr.StringResult.LastIndexOf(pthSep) Ĩ4 // If the path has an extension (this should alwaysĨ5 // be the case), extract the base file nameĩ5 // Create folders for our icons and our scriptsġ08 // Assuming the path and name were set appropriately.ġ14 // Add our suffix if not the first time runġ19 // Our drawing is located in the base pathġ21 string dwgPath = _path + pthSep + name + dwgExt ġ23 // While our script is in a sub-folderġ26 _path + pthSep + scrLoc + pthSep + name + scrExt ġ28 // Create a dummy script, so we can make sure we pickġ29 // up the contents in our dummy execute commandġ33 "This is a dummy script for " + name + "."ġ36 // Now we want to save our drawing and use the imageġ39 // Using either COM or.







How to add block to tool palette in autocad