Load proyect

Load proyect

Anonymous
Not applicable
2,299 Views
10 Replies
Message 1 of 11

Load proyect

Anonymous
Not applicable

Hello, Everybody:

 

I Cannot load the odcl file, I´m a beginner on this.

 

In the last messages I published an automatic base plate and now I want to put dialog box, the big problem 😭 is that I cannot load the examples of the next guide; https://opendcl.com/wordpress/?page_id=10, I can load the examples of the installation program of the route 

 

, this is the message on AutoCAD

 

Number one

1.png

 

And enter

2.png

 

And this on the command bar

3.png

 

So this is my little project:

 

;Creacion de comando
(defun C:placabase()
(alert
"COMANDO PARA CREAR PLACA BASE DE 4 AGUJEROS

Siga los pasos para crear la placa.

1.-Escriba el ancho deseado de la placa.
2.-Escriba el alto de la placa.
3.-Escriba el radio de los 4 agujeros a realizar.
4.-Escriba la separacion de los agujeros para el eje xy.
5.- Enter.")

(command "layer" "new" "Acero Estructural" "color" "t" "0,255,0" "" "")

(setq anchura (getreal "\nIngrese el ancho de la placa base: "))
(setq altura (getreal "\nIngrese el alto de la placa base: "))
(setq radioc (getreal "\nIngrese el radio de la placa base: "))
(setq ejexz (getreal "\nIngrese separación del eje x para los agujeros de la placa: "))
(setq ejeyz (getreal "\nIngrese separación del eje y para los agujeros de la placa: "))
(setq sepacota1 (getreal "\nIngrese separación de la acotación primaria: "))
(setq sepacota2 (getreal "\nIngrese separacion de la acotacion secundaria: "))
(setq pt11 (list 0 0 0))
(setq pt21 (list anchura 0 0))
(setq pt31 (list anchura altura 0))
(setq pt41 (list 0 altura 0))

(setvar "dimtxt" 8.00)
(setvar "dimasz" 😎
(setvar "dimclrd" 1)
(setvar "dimclre" 1)
(setvar "dimclrt" 2)
(setvar "dimdec" 0)


(setq ag11 (list ejexz ejeyz 0))
(setq ag21 (list (- anchura ejexz) ejeyz))
(setq ag31 (list (- anchura ejexz) (- altura ejeyz)))
(setq ag41 (list ejexz (- altura ejeyz) 0))
(setvar "osmode" 0)
(command "line" pt11 pt21 pt31 pt41 "c")

(command "circle" ag11 radioc
"circle" ag21 radioc
"circle" ag31 radioc
"circle" ag41 radioc)
;Inicio de acotación de la placa
;puntos para la acotacion
(setq punto12 (list ejexz altura 0)); para acotacion de agujero superior izquierdo
(setq punto13 (list (- anchura ejexz) altura 0)); para acotacion de agujero superior derecho
(setq punto14 (list 0 ejeyz 0)) ; para cotacion de agujero inferior izquierdo
(setq punto15 (list 0 (- altura ejeyz) 0)) ; para acotacion de agujero superior derecho

(command "dimlinear" pt41 punto12 (list anchura (+ altura sepacota1) 0))
(command "dimlinear" punto13 pt31 (list anchura (+ altura sepacota1) 0))
(command "dimlinear" punto12 punto13 (list anchura (+ altura sepacota1) 0))
(command "dimlinear" pt41 pt31 (list anchura (+ altura sepacota2) 0))

(command "dimvertical" pt11 punto14 (list (- 0 sepacota1) 0 0))
(command "dimvertical" punto14 punto15 (list (- 0 sepacota1) 0 0))
(command "dimaligned" punto15 pt41 (list (- 0 sepacota1) 0 0))
(command "dimaligned" pt11 pt41 (list (- 0 sepacota2) 0 0))

(princ))

 

 

 

Could you help me with it? I´m looking for some videos or something like that for open dcl, dou you know something about it?

 

I´m trying to login in the opendcl forum without success 

 

Best Regards

0 Likes
Accepted solutions (1)
2,300 Views
10 Replies
Replies (10)
Message 2 of 11

Anonymous
Not applicable
Accepted solution

Here is a brief description of how an ODCL project is created. It is abstracted from Chapter 27 of my book AutoCAD expert's Visual LISP. The book is also available in Spanish, both in paper and eBook formats.

Creating the OpenDCL Project.
The first thing to do will be to create a new OpenDCL project, goving it a name. The best option is to save it to a folder with that same name which we include in a folder in AutoCAD’s support files search paths. An OpenDCL application consists of AutoLISP code and OpenDCL project data. The OpenDCL project is created and edited in OpenDCL Studio and may be stored in an ODCL file or embedded into the AutoLISP source code file.
OpenDCL follows the event-driven programming paradigm, so what happens in the user interface triggers the action specified by that particular event’s callback function. A typical OpenDCL application includes in an associated LSP file:
The code required to load and display a form.
The event handlers, i.e., functions that react to events such as selecting a button or list item.
To simplify the project’s structure a LSP file should be created for each form, with the code organized in such a way that the main function is placed first, followed by the auxiliary functions and finally the event callback functions.
To create the new project, select New from the File menu. An Untitled project will be created, which we will save to the project folder.
At the same time, using the Visual LISP Editor we will create a new file which will be saved to the same folder with the same name as the project. This nomenclature is not essential, but it can avoid confusion.
We will begin our project by adding a form using the Project menu. If we select the new form we will see in the Properties tab (Properties/Events Pane) that its (Name) property reads Form1. Using a more explicit nomenclature is advisable in order to avoid confusion, especially in large applications that include several different forms. Controls are usually named using a three-letter prefix that identifies the type of control. In this case we shall use the name frmTest.
Below (Name) we find the (VarName) property. This row is now empty. When a form or control instance is created, OpenDCL sets the value of an AutoLISP variable to a handle used to reference it in the project’s functions. If the (VarName) property field is not empty, that name is used for the variable. Otherwise a variable name is generated by OpenDCL using the pattern:
<project-name>_<form-name>_<control-name>
This aims to ensure a unique name for the variable, given that it will be global in the drawing's context. Using names generated by OpenDCL leaving (VarName) empty is the safest practice. This will also avoid errors when a control is renamed. Let's now review the form's properties.
The user should be able to resize it. For this reason we mark the checkbox next to the Allow Resizing property. The caption then changes to True.
After setting all the form properties we must define in the Events tab those to which the form must react.When an event is checked the template for the event handler function is shown under the AutoLISP Function to Call On Event label. This template can be copied by clicking on the Clipboard Copy button and pasted in the lsp source code file.
Loading the Project and Displaying the Form.
Although we only have an empty form, things must be carefully checked as we move on. So with no further delay, we'll load the project and display the dialog. Any application that uses OpenDCL dialogs should begin by loading the OpenDCL runtime system. If the OpenDCL installation was successful, it will be demand loaded by calling:
(command "_OPENDCL").
After running this command, we can use the Apropos tool to search for functions including the dcl_ prefix. This way we can verify the number of new OpenDCL functions loaded in the Visual LISP environment. These functions enable access to the methods and properties of OpenDCL controls. These functions are defined as protected system symbols, which means that they will also be colored blue when typed in the editor window, just like AutoLISP/Visual LISP primitives.
The call to the OPENDCL command should be followed by a call to dcl_project_load to load the project and to dcl_form_show that displays the form. These functions will be grouped in our program's function that will act as a new AutoCAD command, for example:
(defun C:ODCLTEST (/)
(command "_OPENDCL")
(dcl_project_load "./odcltest/odcltest.odcl" t)
(dcl_form_show odcltest_frmTest))

Before the form is displayed the message included in the default Initialize event's callback function will be shown. This is the event that must be used to set the form's content before it is displayed. Once we click on this message's OK button the form will be displayed, anchored to the left side of AutoCAD's window. Dragging it we can verify the minimum resizing limits. If other drawing is opened the DocActivated event's message is displayed. And on closing all the drawings the EnteringNoDocState event's message will appear. Surely we'll be surprised at how scarce the code is. This is a characteristic of event driven programming. Most of the code will be included in the event’s callback functions.

Now we must add the controls that will complete the Form’s design.

0 Likes
Message 3 of 11

Anonymous
Not applicable

Looking at your code I believe you don't need an ODCL form. You can do it with the classic DCL. 

0 Likes
Message 4 of 11

diagodose2009
Collaborator
Collaborator

You see here 8 version/s on your-programe.All  eight have one source.cpp. I compiel source.cpp to 8 version/s.

First Step ) I replace (command "line") and (command "circle") with two functions

 

command("line",pt11,pt21,pt31,pt41,"c");
command("circle",ag11,radioc,"circle",ag21,radioc,"circle",ag31,radioc,"circle",ag41,radioc);

 

 06August2018=Hram "Schimbarea la fata" Str. Cutitul de Argint nr. 1, sector 4,

 

(dfn_enamk_line pt11 pt21 nil 60 nil) (dfn_enamk_line pt21 pt31 nil 61 nil) 
(dfn_enamk_line pt31 pt41 nil 62 nil) (dfn_enamk_line pt41 pt11 nil 63 nil)

 

 

 11.August=Sfantul Nifon, la biserica de la MegaMall. se de pachete,

 

(dfn_enamk_circle ag11 radioc "" 12 nil)
(dfn_enamk_circle ag21 radioc "" 22 nil)

 

 Second Step) Eu am compilat sursele-interne la 5 versiuni(js_aro10-debugmode).

I work three hours at your-project (click-here) 

You can customize your-*.DCL directly in list-lisp, and you can Add or Remove Edit-label/s to ask(variabile)

 

   (setq
	 aol (list "Siga los pasos para crear la placa." "Czagalamejiajose@forum.ro LoadProyect" "CWH" (list "R0.Ingrese el ancho de la placa base:" 45 45 1) (list nil "R***Help1: Criterile R1 si (R2+R3) se pot folosir doar alternativ." 0 0) (list "R2.Ingrese el alto de la placa base:" 10 10 1) (list "R3.Ingrese el radio de la placa base:" 10 10 1) (list "R4.Ingrese separaci≤n del eje x para los agujeros de la placa:" 10 10 1) (list "R5.Ingrese separaci≤n del eje y para los agujeros de la placa:" 10 10 1) (list "R6.Ingrese separaci≤n de la acotaci≤n primaria:" 10 10 1) (list "R7.Ingrese separacion de la acotacion secundaria:" 10 10 1))
	 def (list 0 "1.100" "text" "1.101" "0.503" "0.773" "0.775" "0.330" "0.335")
	 ask (dfn_dcl_getstrs def aol)) (if (=  ask nil) (progn  (alert isCancelling) (exit))) (dfn_layer_new placabase 7 0 nil) (setq;|a21069|;
	 anchura (atof (nth 0 ask))) (setq
	 altura (atof (nth 2 ask))) (setq
	 radioc (atof (nth 3 ask))) (setq
	 ejexz (atof (nth 4 ask))) (setq
	 ejeyz (atof (nth 5 ask))) (setq
	 sepacota1 (atof (nth 6 ask))) (setq
	 sepacota2 (atof (nth 7 ask))) 

 

Message 5 of 11

lena.talkhina
Alumni
Alumni

Hello @Anonymous  !

Great to see you here on LISP Forum.

Did you find a solution?
If yes, please click on the "Accept as Solution" button as then also other community users can easily find and benefit from the information.
If not please don't hesitate to give an update here in your topic so all members know what ́s the progression on your question is and what might be helpful to achieve what you ́re looking for. 🙂

Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям! | Do you find the posts helpful? "LIKE" these posts!
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.



Лена Талхина/Lena Talkhina
Менеджер Сообщества - Русский/Community Manager - Russian

0 Likes
Message 6 of 11

Anonymous
Not applicable

 

 

 

 

 

0 Likes
Message 7 of 11

Anonymous
Not applicable

Señor Reinaldo, buenos días:

 

De hecho tengo su libro en físico, lo compre en amazon, pero cuando lo compre solo estaba en idioma ingles, creí que con OpenDcl era mas fácil, veo que se encuentra la versión en español, aún así no puedo cargar ni los ejemplos ahorita, en amazona México, yo creo que mejor lo voy a comprar en versión español y pondré enfoque en realizar el DCL, pero fíjese que trato de cargar ejemplos con el DCL clásico y no puedo no se si sea por la versión del Autocad o algo esta mal, estaba chocando la pagina de Afralisp, ( https://www.afralisp.net/dialog-control-language/tutorials/getting-started-part-1.php) por lo que entiendo es necesario cargar un archivo .lsp y un archivo .dcl para que se formen los diálogos y no. la versión de Autocad que tengo es 2015. quizás necesite una mas nueva.

0 Likes
Message 8 of 11

Anonymous
Not applicable

Lena Good Morning.

 

I don´t find a solution yet, but I´ve posted a new message for Mr. Reinaldo.

Sorry for delay in the answer, but I´m trying understand this new and powerfull language for Autocad and following the tips from Mr. Reinaldo, before I make my reply.😅😅

 

 

Thanks Lena

0 Likes
Message 9 of 11

Anonymous
Not applicable

Te adjunto un zip que contiene el proyecto que se crea en el tutorial del Capítulo 22 de mi libro. Para evitar confusiones a este código le he eliminado un par de funciones que se definen en otros capítulos. El proyecto se compone de un archivo de código LSP de nombre ParametricoDCL.lsp y un archivo de código DCL de nombre Parametrico.DCL.

Debes descomprimir el archivo y añadir la carpeta PARAMETRICO a las rutas de búsqueda de AutoCAD.

Este programa crea modelos 3D como Sólidos 3D o como Superficies de acuerdo a las dimensiones que se ingresan en las casillas de texto.

La explicación detallada de todo el proceso se encuentra en el Capítulo 22 del libro. Pero ten en cuenta que la comprensión de todo está contando con que se ha leído y asimilado una buena parte de los 21 Capítulos anteriores.

Creo que esto te puede ayudar ya que veo que estás intentando hacer un programa de dibujo paramétrico también.

Considero que antes de intentar trabajar con OpenDCL debes entender a fondo el DCL original, pues muchos conceptos son similares, sólo que más sencillos en DCL.

Espero te ayude. Saludos

0 Likes
Message 10 of 11

Anonymous
Not applicable

I am attaching a zip that contains the project created in the Chapter 22 tutorial of my book. To avoid confusion with this code I have removed a couple of functions that are defined in other chapters. The project consists of an LSP code file named ParametricoDCL.lsp and a DCL code file named Parametrico.DCL.

You must unzip the file and add the PARAMETRICO folder to the AutoCAD search paths.

This program creates 3D models as 3D Solids or as Surfaces according to the dimensions entered in the text boxes.

The detailed explanation of the entire process is found in Chapter 22 of the book. But keep in mind that understanding everything is counting that a good part of the previous 21 Chapters has been read and assimilated.

I think this can help you since I see that you are trying to make a parametric drawing program too.

I consider that before trying to work with OpenDCL you must thoroughly understand the original DCL, since many concepts are similar, only simpler in DCL.

Hope it helps you. Regards

0 Likes
Message 11 of 11

Sea-Haven
Mentor
Mentor

This is a library routine use in any code where multiple input is required, it can be as big as required or 1 line. It does not have to live in your code as it is loaded as required. You can set default values. 

 

(if (not AH:getvalsm)(load "Multi Getvals.lsp"))
(setq ans (AH:getvalsm (list "Enter Motherboard values"  "Width " 5 4 "1" "Height" 5 4 "2" "Radius" 5 4 "3" "Separation y-axis" 5 4 "4"  "Separation primary dims" 5 4 "5" "Separation secondary action" 5 4 "6" )))

 

It returns a list of the values so you can have strings and numbers. The image would return ("1" "2" "3" "4" "5" "6") you can convert to number using eg (atof (nth 0 ans)) = 1.0

 

Also getvals with image.

screenshot159.png

 

screenshot236.png 

0 Likes