sketchucation logo sketchucation
    • Login
    1. Home
    2. JudyO
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    J
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 6
    • Groups 1

    JudyO

    @JudyO

    10
    Reputation
    1
    Profile views
    6
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    JudyO Unfollow Follow
    registered-users

    Latest posts made by JudyO

    • RE: Reference to deleted Group

      Following this conversation I realized I am doing something Sketchup was not meant to do, So I switched to rotating points instead of edges, and rotate them one by one instead of in a group.
      I still need to keep references to the points (not to the edges), but so far it looks OK.
      Thank you

      posted in Developers' Forum
      J
      JudyO
    • RE: Reference to deleted Group

      Thank you Thomas,
      The reason I gave each edge a name (a reference?) is because after the first rotation I don’t know anymore the start and end points of the edge. I can’t recreate the edge for the next rotation.

      Or do I? Is there a way to get the end points of an edge?
      But then, I will still need the reference to it.
      That was my thinking.

      The reason I added all the edges at the group creation is that I found no other way to do it – add an edge by its name to an existing group.
      I would like to.

      I attach two skp file, the first one is a basic bodice pattern, where all the points are calculated.
      The second one is after closing two darts
      (I don't know if the files were uploaded, we'll see)


      Bodice 1st stage


      Bodice 2nd stage

      posted in Developers' Forum
      J
      JudyO
    • RE: Reference to deleted Group

      I am not sure.

      It is a sewing pattern.
      for example: I need to close a dart on the waist line, this causes edges left (or right) to the dart to rotate.

      After this rotation I wish to close another dart, say at the shoulder. This causes another group of edges to rotate, some of which were already rotated before.

      posted in Developers' Forum
      J
      JudyO
    • RE: Reference to deleted Group

      OK, I cut some of the code, sorry it is so long, I marked the problem place.

      #-------------------------------------------------------------
      def sample
      
      model = Sketchup.active_model
      entities = model.active_entities
      
      
      #-----------------------
      #Create edges for the back;
      
      $pt_N_pt_N11		= entities.add_edges $pt_N11, $pt_N
      $pt_N1_pt_N11 		= entities.add_edges $pt_N1, $pt_N11
      $pt_S3_pt_L 		= entities.add_edges $pt_S3, $pt_L
      $pt_S3_pt_S1		= entities.add_edges $pt_S3,$pt_S1
      $pt_S3_pt_N1		= entities.add_edges $pt_S3, $pt_N1
      $pt_N_pt_W		= entities.add_edges $pt_N, $pt_W
      $pt_L_pt_L1		= entities.add_edges $pt_L, $pt_L1
      $pt_W4_l_pt_BWD		= entities.add_edges $pt_W4_l, $pt_BWD
      $pt_S1_pt_N1		= entities.add_edges $pt_S1, $pt_N1
      $pt_BWD_pt_W3_l 	= entities.add_edges $pt_BWD, $pt_W3_l
      $pt_W_pt_W3_l		= entities.add_edges $pt_W, $pt_W3_l
      $pt_W4_l_pt_W6_l	= entities.add_edges $pt_W4_l, $pt_W6_l
      $pt_L_pt_L2 		= entities.add_edges $pt_L, $pt_L2
      $pt_L1_pt_W6_l		= entities.add_edges $pt_L1, $pt_W6_l
      $pt_BW3_pt_L		= entities.add_edges $pt_BW3, $pt_L
      
      #-----------------------
      # Create a group from these edges;
      
      back_edges_group = entities.add_group $pt_BW3_pt_L,
      $pt_N1_pt_N11,
      $pt_S3_pt_L,
      $pt_N_pt_N11,
      $pt_S3_pt_S1,
      $pt_S3_pt_N1,
      $pt_N_pt_W,
      $pt_L_pt_L1,
      $pt_W4_l_pt_BWD,
      $pt_S1_pt_N1,
      $pt_BWD_pt_W3_l,
      $pt_W_pt_W3_l,
      $pt_W4_l_pt_W6_l,
      $pt_L_pt_L2,
      $pt_L1_pt_W6_l
      
      
      #-----------------------
      #Find rotation angle;
      
      v_tmp1 = $pt_L1 - $pt_W6_l
      v_tmp2 = $pt_L1 - $pt_W5_l
      angle = v_tmp1.angle_between v_tmp2
      
      #-----------------------
      #Rotate the group;
      
      trans_rotation = Geom;;Transformation.rotation $pt_L1 ,$v_z_axis, angle
      back_edges_group.transform! trans_rotation
      
      #-----------------------
      #Explode the group;
      
      back_edges_group.explode
      
      
      #-------------------------------------------------------------
      # Create another group, only for the back upper dart;
      
      back_upper_dart_edges_group = entities.add_group $pt_BW3_pt_L,
      $pt_S3_pt_L,
      $pt_S3_pt_S1
      
      ###########################################################
      ####THE ABOVE LAST EDGE CAUSES "REFERENCE TO DELETED ENTITY"
      ####ALTHOUGH THE 2 EDGDES ABOVE IT WERE ALSO IN THE PREVIOUS GROUP.
      ####IF THIS EDGE IS REMARKED OUT ALL IS WELL
      ###########################################################
      
      
      #-----------------------
      #find angle between L-L1 and L-BW3;
      
      v_tmp1 = $pt_L - $pt_L1
      v_tmp2 = $pt_L - $pt_BW3
      angle = v_tmp2.angle_between v_tmp1
      
      #-----------------------
      #Rotate the group;
      
      trans_rotation = Geom;;Transformation.rotation $pt_L ,$v_z_axis,  angle
      back_upper_dart_edges_group.transform! trans_rotation
      
      #-----------------------
      #Explode the group;
      back_upper_dart_edges_group.explode
      
      end
      
      
      posted in Developers' Forum
      J
      JudyO
    • RE: Reference to deleted Group

      OK TIG, I'll cut some of the code and post it soon (I'm a bit embarrassed, it probably looks terrible)

      posted in Developers' Forum
      J
      JudyO
    • Reference to deleted Group

      I don't know if I am in the right place for trivial question, but I'll try.

      I am a beginner, I write a plugin for sewing patterns according to input body measurements.
      These are 2D drawings.

      There are many edges and sometimes I need to rotate some of them.
      I create a group and add the relevant edges to the group.
      I then rotate the group
      Then I explode the group.

      Then I wish to rotate another group of edges, some of which were already rotated in the previous group.

      And this is where all fails. When I create the second group SOME of the edges that were in the previous group cause error message "reference to deleted Group".

      This is so strange, some edges have no problem, others are stuck.

      How to disconnect the relation between the edge entity and its old group that was already exploded?

      posted in Developers' Forum
      J
      JudyO