Jump to content

Writing Python scripts for Vectorworks using ChatGPT


Recommended Posts

Some have in thread below:

 

I have started using it, and I must say it is both cool and scary at the same time. Not too sure how to feel about it yet.

It can write articles, even write full code, and can also write a song or a poem. Honestly still trying to wrap my head around its functionality and use-cases. Definitly something to keep an eye on. 

A screen recording below, obviously not everything is correct in the article, but I think it depends on the prompts you ask it as its based on a highly advanced Natural Language Training model. It is quite fun, in a dreading kind of way.lol

 

 

 

 

  • Like 1
  • Laugh 1
Link to comment

@elepp also has been talking about chatgpt, maybe.

19 hours ago, Pat Stanford said:

But it used a huge number of functions that don't actually exist in VW or VW Pythonscript.

afaik you can implement them in vw (although I still don't know how)

1 hour ago, Christiaan said:

Does ChatGPT actually learn from user input?

think so, in the beginning, when you log in for the first time, you got told not to write sensitive information, there...

  • Like 1
Link to comment

It remembers for that particular thread. Once you reset the thread, all previous interactions are deleted. However all your inputs are used to feedback into the overall AI's algorithm/learning. So releasing this into the wild by the developers is not for fun times, the AI is need of interactive data, which is why I believe they've released it.

 

Edited by twk
  • Like 1
Link to comment

Found this:

https://help.openai.com/en/articles/6783457-chatgpt-faq

 

Quote

Who can view my conversations?

As part of our commitment to safe and responsible AI, we review conversations to improve our systems and to ensure the content complies with our policies and safety requirements.

 

Will you use my conversations for training?

Yes. Your conversations may be reviewed by our AI trainers to improve our systems.

 

  • Like 1
Link to comment
On 12/13/2022 at 7:16 PM, Pat Stanford said:

In another thread someone asked ChatGPT to write a Python program for VW.  The result looked very nice. But it used a huge number of functions that don't actually exist in VW or VW Pythonscript.

 

But it could probably be a good outline for someone who then had the logic and just needs to implement the specific calls.

 

I played around a bit with ChatGPT but I have the same experience: the AI writes code with a lot of functions that simply don't exist. I think it has to do with the very little documentation that is provided at developer.vectorworks.net.

Edited by Niels Timmer
Link to comment
  • 4 weeks later...
  • 8 months later...

Thought this was quite funny. This is the script ChatGPT gave me when I asked it for a script that would draw a smiley face. (spoiler alert, it doesn't provide a smiley face)

 

import vs

def draw_smiley_face(center_x, center_y, face_radius):
    """
    Draw a smiley face in Vectorworks.

    Parameters:
    center_x (float): X-coordinate of the center of the face.
    center_y (float): Y-coordinate of the center of the face.
    face_radius (float): Radius of the face.
    """
    # Draw the face
    vs.Oval(center_x - face_radius, center_y - face_radius, center_x + face_radius, center_y + face_radius)

    # Calculate eye positions and sizes based on face radius
    eye_radius = face_radius * 0.1
    eye_offset_x = face_radius * 0.3
    eye_offset_y = face_radius * 0.3

    # Draw the left eye
    vs.Oval(center_x - eye_offset_x - eye_radius, center_y + eye_offset_y - eye_radius, 
            center_x - eye_offset_x + eye_radius, center_y + eye_offset_y + eye_radius)

    # Draw the right eye
    vs.Oval(center_x + eye_offset_x - eye_radius, center_y + eye_offset_y - eye_radius, 
            center_x + eye_offset_x + eye_radius, center_y + eye_offset_y + eye_radius)

    # Draw the mouth (using a 180-degree arc for simplicity)
    mouth_radius = face_radius * 0.4
    vs.Arc(center_x - mouth_radius, center_y - eye_offset_y - mouth_radius/2, 
           center_x + mouth_radius, center_y - eye_offset_y + mouth_radius/2, 
           0, 180)

# Call the function to draw a smiley face at (0,0) with a face radius of 200 units
draw_smiley_face(0, 0, 200)

 

Link to comment
  • 4 weeks later...

I've just started using VW again after a long pause and move to a new country, so I thought I would try asking GPT to write a script to help convert some text with heigh coordinates into a 3d loci. There is a marionette script here for that...but I had issues getting the nodes to visually scale properly ( the buttons are tiny if I bring them into my drawing) . Figured a script might work....so I just have to set up the layer structure in the script and try it out.

In theory, GPT should be a huge asset to help programming noobs....and even for those who are handy....to really create some useful parametric features for things like 3d modelling. It will be interesting to see if it can also help automate translating different materials (e.g. converting landscape area styles to hardscape styles...since I basically only used landscape areas until recent upgrades to the hardscape functions)

image.thumb.png.d88037acbb275f97a4e4ff1268c63093.png

 

---------------------------

 

Procedure ConvertTextTo3DLoci;
Var
   textHd, lociHd :Handle;
   textValue :Real;
   x, y, z :Real;
Begin
   { Iterate through all 2D text objects }
   ForEachObjectInLayer(textHd, 11, 3) Do  { Use appropriate criteria for 2D text objects }
   Begin
      { Get the text value as a real number }
      textValue := Str2Num(GetText(textHd));
      
      { Get the X and Y position of the text }
      GetXandY(textHd, x, y);
      
      { Set Z value based on the text value }
      z := textValue;
      
      { Create a 3D Loci at the calculated X, Y, Z coordinates }
      lociHd := Locus(x, y, z);
   End;
End;

Run(ConvertTextTo3DLoci);
 

Edited by Poot
Link to comment

ChatGPT will lie to you all day about VectorScript/Python Script in VW.

 

GetXandY is not a valid VS function.  You can probably dig the information you need out of either GetBBox or GetTextOrientation.

 

If the text contains anything other than digits you may also need to use SubString to extract only the digits.

 

Probably other errors as well, but that is all the time I have right now.

 

 

Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...